Browse Source

init

pull/397/head
xcps 9 years ago
parent
commit
0fe7bdf849
  1. 8
      I2PTunnel.cpp

8
I2PTunnel.cpp

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

Loading…
Cancel
Save