summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicael Karlberg <bmk@erlang.org>2023-04-05 16:58:35 +0200
committerMicael Karlberg <bmk@erlang.org>2023-04-14 11:09:09 +0200
commit68609e0fe065b15d1bf1cd0a267294b1dddbf22b (patch)
treed8d9a22b698418132a519ef752b782285c7e11ca
parent5a737b7f02c95cce6ddbea66f52ea56c13f37842 (diff)
downloaderlang-68609e0fe065b15d1bf1cd0a267294b1dddbf22b.tar.gz
[erts|esock] Tweaked warning messages
OTP-18029
-rw-r--r--erts/emulator/nifs/win32/win_socket_asyncio.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/erts/emulator/nifs/win32/win_socket_asyncio.c b/erts/emulator/nifs/win32/win_socket_asyncio.c
index f91e7edc48..06af1201e2 100644
--- a/erts/emulator/nifs/win32/win_socket_asyncio.c
+++ b/erts/emulator/nifs/win32/win_socket_asyncio.c
@@ -8865,10 +8865,12 @@ void esaio_dtor(ErlNifEnv* env,
* so we must have closed it properly to get here
*/
if (! IS_CLOSED(descP->readState) )
- esock_warning_msg("Socket Read State not CLOSED at dtor\r\n");
+ esock_warning_msg("Socket Read State not CLOSED (0x%X) "
+ "at dtor\r\n", descP->readState);
if (! IS_CLOSED(descP->writeState) )
- esock_warning_msg("Socket Write State not CLOSED at dtor\r\n");
+ esock_warning_msg("Socket Write State not CLOSED (0x%X) "
+ "at dtor\r\n", descP->writeState);
if ( descP->sock != INVALID_SOCKET )
esock_warning_msg("Socket %d still valid\r\n", descP->sock);
@@ -8949,7 +8951,21 @@ void esaio_stop(ErlNifEnv* env,
err = esock_close_socket(env, descP, FALSE);
- if (err != 0)
+ switch (err) {
+ case NO_ERROR:
+ break;
+ case WSAENOTSOCK:
+ if (descP->sock != INVALID_SOCKET)
+ esock_warning_msg("[WIN-ESAIO] Attempt to close an "
+ "already closed socket"
+ "\r\n(without a closer process): "
+ "\r\n Controlling Process: %T"
+ "\r\n socket fd: %d"
+ "\r\n",
+ descP->ctrlPid, descP->sock);
+ break;
+
+ default:
esock_warning_msg("[WIN-ESAIO] Failed closing socket without "
"closer process: "
"\r\n Controlling Process: %T"
@@ -8957,6 +8973,9 @@ void esaio_stop(ErlNifEnv* env,
"\r\n Errno: %T"
"\r\n",
descP->ctrlPid, descP->sock, ENO2T(env, err));
+ break;
+ }
+
}
SSDBG( descP,