Skip to content

Commit 48602cf

Browse files
authored
Fix #1055 Socket Mode: ENOTSOCK every 300 minutes on Windows (#1091)
1 parent b2364d2 commit 48602cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

slack_sdk/socket_mode/builtin/internals.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ def receive(specific_buffer_size: Optional[int] = None):
204204
logger.debug(f"Received bytes: {received_bytes}")
205205
return received_bytes
206206
except OSError as e:
207-
if e.errno == errno.EBADF:
207+
# For Linux/macOS, errno.EBADF is the expected error for bad connections.
208+
# The errno.ENOTSOCK can be sent when running on Windows OS.
209+
if e.errno in (errno.EBADF, errno.ENOTSOCK):
208210
logger.debug("The connection seems to be already closed.")
209211
return bytes()
210212
raise e

0 commit comments

Comments
 (0)