From b28c123b01e8b7e8e425c6bace3632aafa8b3c24 Mon Sep 17 00:00:00 2001 From: Payden Sutherland Date: Sat, 6 Oct 2012 17:10:22 -0400 Subject: [PATCH] Do not allow libwsclient_send after close frame. --- wsclient.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wsclient.c b/wsclient.c index 1ed3097..f133a88 100644 --- a/wsclient.c +++ b/wsclient.c @@ -497,6 +497,11 @@ int stricmp(const char *s1, const char *s2) { int libwsclient_send(wsclient *client, char *strdata) { pthread_mutex_lock(&client->lock); + if(client->flags & CLIENT_SENT_CLOSE_FRAME) { + fprintf(stderr, "Trying to send data after sending close frame. Not sending.\n"); + pthread_mutex_unlock(&client->lock); + return 0; + } if(client->flags & CLIENT_CONNECTING) { pthread_mutex_unlock(&client->lock); pthread_join(client->handshake_thread, NULL);