[libsoup/wip/websocket-close-bug] websocket-connection: skip pong if closing the connection



commit 83636b487ba0fec1e50fc3a034d08fa14f177ba0
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Nov 23 12:37:24 2016 +0100

    websocket-connection: skip pong if closing the connection

 libsoup/soup-websocket-connection.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
index 66742a1..f00dbd0 100644
--- a/libsoup/soup-websocket-connection.c
+++ b/libsoup/soup-websocket-connection.c
@@ -568,9 +568,14 @@ receive_close (SoupWebsocketConnection *self,
 
 static void
 receive_ping (SoupWebsocketConnection *self,
-                      const guint8 *data,
-                      gsize len)
+              const guint8 *data,
+              gsize len)
 {
+       if (soup_websocket_connection_get_state (self) == SOUP_WEBSOCKET_STATE_CLOSING) {
+               g_info ("A client sent a ping message when closing the connection. Skipping pong...");
+               return;
+       }
+
        /* Send back a pong with same data */
        g_debug ("received ping, responding");
        send_message (self, SOUP_WEBSOCKET_QUEUE_URGENT, 0x0A, data, len);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]