diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-11 18:13:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-11 18:13:57 +0000 |
commit | 4e97ad35d21d21e45a1a43e4311ac6bd8e9705ab (patch) | |
tree | f6287073e8ade19bda5f6499b52f4a521b56ad5d /src | |
parent | 1fe5239a34ae86d08a1dfcde7ed1554d8faf4aa3 (diff) |
Fixes to make it work :p (obviously)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@545 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/connection.cpp b/src/connection.cpp index 609b98880..f4ab75f0a 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -77,11 +77,13 @@ bool connection::CreateListener(char* host, int p) this->port = p; - setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(const char*)&on,sizeof(on)); - linger.l_onoff = 1; - linger.l_linger = 0; - setsockopt(fd,SOL_SOCKET,SO_LINGER,(const char*)&linger,sizeof(linger)); + setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(const char*)&on,sizeof(on)); + linger.l_onoff = 1; + linger.l_linger = 0; + setsockopt(fd,SOL_SOCKET,SO_LINGER,(const char*)&linger,sizeof(linger)); + buffer.clear(); + return true; } @@ -305,7 +307,7 @@ bool connection::RecvPacket(char *message, char* host, int &prt, long &theirkey) //int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); if (recvfrom(fd,&p,sizeof(p),0,(sockaddr*)&host_address,&host_address_size)<0) { - if (buffer.size()) + if (buffer.size()>0) { log(DEBUG,"Fetching a buffered packet size %d",buffer.size()); strcpy(message,buffer[0].p.data); @@ -348,7 +350,7 @@ bool connection::RecvPacket(char *message, char* host, int &prt, long &theirkey) prt = ntohs(host_address.sin_port); // the port we received it on SendACK(host,prt,p.id); - if (buffer.size()) + if (buffer.size()>0) { log(DEBUG,"Fetching a buffered packet size %d",buffer.size()); packet_buf pb; |