From c6710c7a70658536ab0217dff18a45622ea08680 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 7 Jun 2011 00:48:37 +0200 Subject: [PATCH] Fix CPU Usage bug when using -nolisten and have no connections. --- src/net.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 39360a33..c884e8d5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -756,9 +756,12 @@ void ThreadSocketHandler2(void* parg) if (nSelect == SOCKET_ERROR) { int nErr = WSAGetLastError(); - printf("socket select error %d\n", nErr); - for (int i = 0; i <= hSocketMax; i++) - FD_SET(i, &fdsetRecv); + if (hSocketMax > -1) + { + printf("socket select error %d\n", nErr); + for (int i = 0; i <= hSocketMax; i++) + FD_SET(i, &fdsetRecv); + } FD_ZERO(&fdsetSend); FD_ZERO(&fdsetError); Sleep(timeout.tv_usec/1000);