From 8799f9079b9d0368cf226c4060e5706a786354e5 Mon Sep 17 00:00:00 2001 From: xcps Date: Mon, 29 Feb 2016 02:15:29 +0500 Subject: [PATCH] change part for replace --- I2PTunnel.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index 0904ed35..f1d4a488 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -243,17 +243,17 @@ namespace client void I2PTunnelConnectionIRC::Write (const uint8_t * buf, size_t len) { - char *p = (char*)(buf + len); - *p = '\0'; std::string line; m_OutPacket.str (""); - m_InPacket.str (""); m_InPacket.clear (); m_InPacket.write ((const char *)buf, len); while (!m_InPacket.eof () && !m_InPacket.fail ()) { std::getline (m_InPacket, line); + if (line.length () == 0 && m_InPacket.eof ()) { + m_InPacket.str (""); + } auto pos = line.find ("USER"); if (pos != std::string::npos && pos == 0) { @@ -261,8 +261,6 @@ namespace client pos++; pos = line.find (" ", pos); pos++; - pos = line.find (" ", pos); - pos++; auto nextpos = line.find (" ", pos); m_OutPacket << line.substr (0, pos); m_OutPacket << context.GetAddressBook ().ToAddress (m_From->GetIdentHash ());