summaryrefslogtreecommitdiff
path: root/src/connection.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-28 16:06:48 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-28 16:06:48 +0000
commit298f76d8b85157763dfdca5a0ec82d5bfa0272f2 (patch)
tree997d37ed322fd91009fb0fea6b4173efbfdb3b6c /src/connection.cpp
parent90125b5053d8a6fb4dba01ff1cd68149557a8856 (diff)
Added new and improved GetBuffer function based on research on crappy redhat 7.3
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1241 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/connection.cpp')
-rw-r--r--src/connection.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index c77db382c..8a6557e9d 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -166,18 +166,21 @@ void ircd_connector::ClearBuffer()
std::string ircd_connector::GetBuffer()
{
- char* line = (char*)ircdbuffer.c_str();
- char ret[MAXBUF];
- std::stringstream* stream = new std::stringstream(std::stringstream::in | std::stringstream::out);
- *stream << ircdbuffer;
- stream->getline(ret,MAXBUF);
- while ((*line != '\n') && (strlen(line)))
- line++;
- if ((*line == '\n') || (*line == '\r'))
- line++;
- ircdbuffer = line;
- delete stream;
- return ret;
+ // Fix by Brain 28th Apr 2005
+ // seems my stringstream code isnt liked by linux
+ // EVEN THOUGH IT IS CORRECT! Fixed by using a different
+ // (SLOWER) algorithm...
+ char* line = (char*)ircdbuffer.c_str();
+ std::string ret = "";
+ while ((*line != '\n') && (strlen(line)))
+ {
+ ret = ret + *line;
+ line++;
+ }
+ if ((*line == '\n') || (*line == '\r'))
+ line++;
+ ircdbuffer = line;
+ return ret;
}
bool ircd_connector::MakeOutboundConnection(char* newhost, int newport)