diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-11 17:35:09 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-11 17:35:09 +0000 |
commit | 0bf762ee3898a853066adecf1cc85a71b077591d (patch) | |
tree | 367afe73a601a04f4f940dee613156125deb4f77 /src/connection.cpp | |
parent | 292bab4c818af5a189b6ff393d4c9e522b5fdd6e (diff) |
Attempted sync fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@538 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/connection.cpp')
-rw-r--r-- | src/connection.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/connection.cpp b/src/connection.cpp index b1ed34455..574139e1a 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -160,7 +160,7 @@ bool connection::SendPacket(char *message, char* host, int port, long ourkey) int res = select(65535, &sfd, NULL, NULL, &tval); cycles++; } - while ((recvfrom(fd,&p2,sizeof(p2),0,(sockaddr*)&host_address,&host_address_size)<0) && (cycles < 10)); + while ((recvfrom(fd,&p2,sizeof(p2),MSG_PEEK,(sockaddr*)&host_address,&host_address_size)<0) && (cycles < 10)); if (cycles >= 10) { @@ -168,6 +168,13 @@ bool connection::SendPacket(char *message, char* host, int port, long ourkey) } else { + if (p2.type != PT_ACK_ONLY) + { + log(DEFAULT,"ERROR! connection::SendPacket() received a data response and was expecting a syn!!!"); + this->state = STATE_CLEAR; + return true; + } + if (p2.id != p.id) { log(DEFAULT,"ERROR! connection::SendPacket() received an ack for a packet it didnt send!"); @@ -284,6 +291,7 @@ bool connection::RecvPacket(char *message, char* host, int &prt, long &theirkey) host_address.sin_family=AF_INET; host_address_size=sizeof(host_address); + //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) { return false; |