This commit is contained in:
xcps 2016-02-28 18:03:12 +05:00
parent a26dc39a6d
commit 0fe7bdf849

View File

@ -243,9 +243,14 @@ namespace client
void I2PTunnelConnectionIRC::Write (const uint8_t * buf, size_t len)
{
char *p = (char*)(buf + len);
*p = '\0';
LogPrint (eLogError, "======= packet received =====\n", buf, "==============\n");
std::string line;
m_OutPacket.str ("");
m_InPacket.clear ();
m_InPacket.write ((const char *)buf, len);
LogPrint (eLogError, "======= inpacket =====\n", m_InPacket.str ().c_str (), "==============\n");
while (!m_InPacket.eof () && !m_InPacket.fail ())
{
@ -260,7 +265,6 @@ namespace client
pos = line.find (" ", pos);
pos++;
auto nextpos = line.find (" ", pos);
m_OutPacket << line.substr (0, pos);
m_OutPacket << context.GetAddressBook ().ToAddress (m_From->GetIdentHash ());
m_OutPacket << line.substr (nextpos) << '\n';
@ -268,7 +272,7 @@ namespace client
m_OutPacket << line << '\n';
}
}
LogPrint (eLogError, m_OutPacket.str ().substr (0, m_OutPacket.str ().length ()));
LogPrint (eLogError, "======= outpacket =====\n", m_OutPacket.str ().substr (0, m_OutPacket.str ().length ()), "============\n");
I2PTunnelConnection::Write ((uint8_t *)m_OutPacket.str ().c_str (), m_OutPacket.str ().length ());
}