summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/connection.cpp9
1 files changed, 9 insertions, 0 deletions
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<std::string> &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)