diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-09-10 16:57:24 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-10-09 13:37:08 +0200 |
commit | 56b3460aa318b650f12833ba119fa6decb930148 (patch) | |
tree | 5f0e4dea4d3b4130b63179a86cf2a4257cf3a33a /win | |
parent | 6029d50080bb795524d6cefe8d6b4b9b88475bdd (diff) | |
download | tigervnc-56b3460aa318b650f12833ba119fa6decb930148.tar.gz tigervnc-56b3460aa318b650f12833ba119fa6decb930148.zip |
Consistently use SocketException for socket errors
The behaviour is not consistent as Windows doesn't use errno for socket
errors, but Unix systems do. Always use the same exception to keep
things somewhat sane.
Diffstat (limited to 'win')
-rw-r--r-- | win/rfb_win32/SocketManager.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx index 57b65aef..2bc2f53e 100644 --- a/win/rfb_win32/SocketManager.cxx +++ b/win/rfb_win32/SocketManager.cxx @@ -67,7 +67,7 @@ void SocketManager::addListener(network::SocketListener* sock_, flags |= FD_ADDRESS_LIST_CHANGE; try { if (event && (WSAEventSelect(sock_->getFd(), event, flags) == SOCKET_ERROR)) - throw rdr::SystemException("Unable to select on listener", WSAGetLastError()); + throw rdr::SocketException("Unable to select on listener", WSAGetLastError()); // requestAddressChangeEvents MUST happen after WSAEventSelect, so that the socket is non-blocking if (acn) @@ -184,7 +184,7 @@ int SocketManager::checkTimeouts() { if (j->second.sock->outStream().hasBufferedData()) eventMask |= FD_WRITE; if (WSAEventSelect(j->second.sock->getFd(), j->first, eventMask) == SOCKET_ERROR) - throw rdr::SystemException("unable to adjust WSAEventSelect:%u", WSAGetLastError()); + throw rdr::SocketException("unable to adjust WSAEventSelect:%u", WSAGetLastError()); } } @@ -234,11 +234,11 @@ void SocketManager::processEvent(HANDLE event) { // Fetch why this event notification triggered if (WSAEnumNetworkEvents(ci.sock->getFd(), event, &network_events) == SOCKET_ERROR) - throw rdr::SystemException("unable to get WSAEnumNetworkEvents:%u", WSAGetLastError()); + throw rdr::SocketException("unable to get WSAEnumNetworkEvents:%u", WSAGetLastError()); // Cancel event notification for this socket if (WSAEventSelect(ci.sock->getFd(), event, 0) == SOCKET_ERROR) - throw rdr::SystemException("unable to disable WSAEventSelect:%u", WSAGetLastError()); + throw rdr::SocketException("unable to disable WSAEventSelect:%u", WSAGetLastError()); // Reset the event object WSAResetEvent(event); @@ -266,7 +266,7 @@ void SocketManager::processEvent(HANDLE event) { if (ci.sock->outStream().hasBufferedData()) eventMask |= FD_WRITE; if (WSAEventSelect(ci.sock->getFd(), event, eventMask) == SOCKET_ERROR) - throw rdr::SystemException("unable to re-enable WSAEventSelect:%u", WSAGetLastError()); + throw rdr::SocketException("unable to re-enable WSAEventSelect:%u", WSAGetLastError()); } catch (rdr::Exception& e) { vlog.error("%s", e.str()); remSocket(ci.sock); |