Fix: check whether socket is connected before attempting to send
@@ -465,13 +465,19 @@ int32_t SOCKETS_Send( Socket_t xSocket,
}
ctx = ( ss_ctx_t * ) xSocket;
- ctx->send_flag = ulFlags;
+
+ if( ( ctx->status & SS_STATUS_CONNECTED ) != SS_STATUS_CONNECTED )
+ {
+ return SOCKETS_ENOTCONN;
+ }
if( 0 > ctx->ip_socket )
{
return SOCKETS_SOCKET_ERROR;
}
+ ctx->send_flag = ulFlags;
+
if( ctx->enforce_tls )
{
/* Send through TLS pipe, if negotiated. */
