diff --git a/VERSION b/VERSION index e8423da8..5f749c13 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.10 +0.4.11 diff --git a/nostr_core/nostr_core.h b/nostr_core/nostr_core.h index 14cf35ac..2141751d 100644 --- a/nostr_core/nostr_core.h +++ b/nostr_core/nostr_core.h @@ -2,10 +2,10 @@ #define NOSTR_CORE_H // Version information (auto-updated by increment_and_push.sh) -#define VERSION "v0.4.10" +#define VERSION "v0.4.11" #define VERSION_MAJOR 0 #define VERSION_MINOR 4 -#define VERSION_PATCH 10 +#define VERSION_PATCH 11 /* * NOSTR Core Library - Complete API Reference diff --git a/nostr_websocket/nostr_websocket_openssl.c b/nostr_websocket/nostr_websocket_openssl.c index 38714c9b..e4a8a8af 100644 --- a/nostr_websocket/nostr_websocket_openssl.c +++ b/nostr_websocket/nostr_websocket_openssl.c @@ -453,6 +453,13 @@ static int tcp_connect(void* ctx, const char* host, int port) { tcp->socket_fd = -1; return -1; } + + // Safety timeout: prevent indefinite blocking in recv/send on half-broken sockets. + struct timeval io_timeout; + io_timeout.tv_sec = 5; + io_timeout.tv_usec = 0; + (void)setsockopt(tcp->socket_fd, SOL_SOCKET, SO_RCVTIMEO, &io_timeout, sizeof(io_timeout)); + (void)setsockopt(tcp->socket_fd, SOL_SOCKET, SO_SNDTIMEO, &io_timeout, sizeof(io_timeout)); return 0; }