From 3c56d9b753a5fdd61a8010edd68d0db5baf68790 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 28 Apr 2005 16:33:57 +0000 Subject: Added poll delay in server socket read git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1242 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/connection.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/connection.cpp') diff --git a/src/connection.cpp b/src/connection.cpp index 8a6557e9d..1beaefbf7 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -472,6 +472,15 @@ bool connection::RecvPacket(std::deque &messages, char* recvhost) { // returns false if the packet could not be sent (e.g. target host down) int rcvsize = 0; + + // check if theres any data on this socket + // if not, continue onwards to the next. + pollfd polls; + polls.fd = this->fd; + polls.events = POLLIN; + int ret = poll(&polls,1,1); + if (ret <= 0) continue; + rcvsize = recv(this->connectors[i].GetDescriptor(),data,4096,0); data[rcvsize] = '\0'; if (rcvsize == -1) -- cgit v1.2.3