Skip to content
/ i2pd Public
forked from PurpleI2P/i2pd

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
xcps committed Feb 28, 2016
1 parent a26dc39 commit 0fe7bdf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions I2PTunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ())
{
Expand All @@ -260,15 +265,14 @@ 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';
} else {
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 ());
}

Expand Down

0 comments on commit 0fe7bdf

Please sign in to comment.