[libsoup/wip/websocket-close-bug] websocket-connection: skip pong if close was already sent



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

    websocket-connection: skip pong if close was already sent

 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..3234981 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 (self->pv->close_sent) {
+               g_info ("A client sent a ping message after close was sent. 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]