changeset 667:36076641d6b6 draft

Fix CPU Usage bug when using -nolisten and have no connections.
author Matt Corallo <matt@bluematt.me>
date Tue, 07 Jun 2011 00:48:37 +0200
parents 918d3efbd9c4
children cbd2f4849f44
files src/net.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -756,9 +756,12 @@
         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);