From a6b995939ab31a314b0f4156f4c55ee9e28116fe Mon Sep 17 00:00:00 2001 From: Sektor van Skijlen Date: Mon, 20 Jan 2025 10:30:53 +0100 Subject: [PATCH] [core] Fixed misleading error message for listening socket (#3102). --- scripts/generate-error-types.tcl | 10 +++++----- srtcore/strerror_defs.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/generate-error-types.tcl b/scripts/generate-error-types.tcl index e4d29c623..a24fd6216 100755 --- a/scripts/generate-error-types.tcl +++ b/scripts/generate-error-types.tcl @@ -109,17 +109,17 @@ set errortypes { NOTSUP "Operation not supported" { NONE "" ISBOUND "Cannot do this operation on a BOUND socket" - ISCONNECTED "Cannot do this operation on a CONNECTED socket" + ISCONNECTED "Cannot do this operation on a CONNECTED or LISTENING socket" INVAL "Bad parameters" SIDINVAL "Invalid socket ID" ISUNBOUND "Cannot do this operation on an UNBOUND socket" NOLISTEN "Socket is not in listening state" ISRENDEZVOUS "Listen/accept is not supported in rendezvous connection setup" ISRENDUNBOUND "Cannot call connect on UNBOUND socket in rendezvous connection setup" - INVALMSGAPI "Incorrect use of Message API (sendmsg/recvmsg)." - INVALBUFFERAPI "Incorrect use of Buffer API (send/recv) or File API (sendfile/recvfile)." + INVALMSGAPI "Incorrect use of Message API (sendmsg/recvmsg)" + INVALBUFFERAPI "Incorrect use of Buffer API (send/recv) or File API (sendfile/recvfile)" BUSY "Another socket is already listening on the same port" - XSIZE "Message is too large to send (it must be less than the SRT send buffer size)" + XSIZE "Message too large to send (exceeds send buffer size)" EIDINVAL "Invalid epoll ID" EEMPTY "All sockets removed from epoll, waiting would deadlock" BUSYPORT "Another socket is bound to that port and is not reusable for requested settings" @@ -169,7 +169,7 @@ const char* strerror_get_message(size_t major, size_t minor) } const char** array = strerror_array_major[major]; - size_t size = strerror_array_sizes[major]; + const size_t size = strerror_array_sizes[major]; if (minor >= size) { diff --git a/srtcore/strerror_defs.cpp b/srtcore/strerror_defs.cpp index e99c8e277..4a93d6a2f 100644 --- a/srtcore/strerror_defs.cpp +++ b/srtcore/strerror_defs.cpp @@ -66,7 +66,7 @@ const char* strerror_msgs_filesystem [] = { const char* strerror_msgs_notsup [] = { "Operation not supported", // MN_NONE = 0 "Operation not supported: Cannot do this operation on a BOUND socket", // MN_ISBOUND = 1 - "Operation not supported: Cannot do this operation on a CONNECTED socket", // MN_ISCONNECTED = 2 + "Operation not supported: Cannot do this operation on a CONNECTED or LISTENING socket", // MN_ISCONNECTED = 2 "Operation not supported: Bad parameters", // MN_INVAL = 3 "Operation not supported: Invalid socket ID", // MN_SIDINVAL = 4 "Operation not supported: Cannot do this operation on an UNBOUND socket", // MN_ISUNBOUND = 5 @@ -76,7 +76,7 @@ const char* strerror_msgs_notsup [] = { "Operation not supported: Incorrect use of Message API (sendmsg/recvmsg)", // MN_INVALMSGAPI = 9 "Operation not supported: Incorrect use of Buffer API (send/recv) or File API (sendfile/recvfile)", // MN_INVALBUFFERAPI = 10 "Operation not supported: Another socket is already listening on the same port", // MN_BUSY = 11 - "Operation not supported: Message is too large to send", // MN_XSIZE = 12 + "Operation not supported: Message too large to send (exceeds send buffer size)", // MN_XSIZE = 12 "Operation not supported: Invalid epoll ID", // MN_EIDINVAL = 13 "Operation not supported: All sockets removed from epoll, waiting would deadlock", // MN_EEMPTY = 14 "Operation not supported: Another socket is bound to that port and is not reusable for requested settings", // MN_BUSYPORT = 15