summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-11 18:58:00 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-11 18:58:00 +0000
commit11db95f0d12fb696d890a63a887f93b4beb14b5b (patch)
tree34ee73f3e5edb909ab757718204bc5698f5162dd /src
parentfc7856deae79857b384df70d91dd971f86f7b331 (diff)
Fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@552 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/connection.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 156a5fcea..a7f7ed0a1 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -148,10 +148,24 @@ bool connection::SendPacket(char *message, char* host, int port, long ourkey)
host_address.sin_family=AF_INET;
host_address_size=sizeof(host_address);
- if (recvfrom(fd,&p2,sizeof(p2),0,(sockaddr*)&host_address,&host_address_size)<0)
+ // wait for ack, or timeout.
+ // if reached a timeout, send again.
+ // the packet id in the ack must match that in the original packet
+ // this MUST operate in lock/step fashion!!!
+ int cycles = 0;
+ packet p2;
+ do
{
- return false;
+ fd_set sfd;
+ timeval tval;
+ tval.tv_usec = 100;
+ tval.tv_sec = 0;
+ FD_ZERO(&sfd);
+ FD_SET(fd,&sfd);
+ 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));
if (cycles >= 10)
{