From 987480f6c94bd051cfbffe6b885986d4de314cba Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Mon, 9 May 2022 09:01:59 +0100
Subject: [PATCH] Handle WSAPoll errors

---
 src/universe.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/universe.cpp b/src/universe.cpp
index b3ade7a..f6f1bdf 100644
--- a/src/universe.cpp
+++ b/src/universe.cpp
@@ -489,11 +489,18 @@ void Universe::_run() {
 
 		//Some kind of error occured, it is usually possible to recover from this.
 		if (selres < 0) {
+			#ifdef WIN32
+			int errNum = WSAGetLastError();
+			switch (errNum) {
+			default	: LOG(WARNING) << "Unhandled poll error: " << errNum;
+			}
+			#else
 			switch (errno) {
 			case 9	: continue;  // Bad file descriptor = socket closed
 			case 4	: continue;  // Interrupted system call ... no problem
-			default	: LOG(WARNING) << "Unhandled select error: " << strerror(errno) << "(" << errno << ")";
+			default	: LOG(WARNING) << "Unhandled poll error: " << strerror(errno) << "(" << errno << ")";
 			}
+			#endif
 			continue;
 		} else if (selres == 0) {
 			// Timeout, nothing to do...
-- 
GitLab