summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTor Hveem <tor@hveem.no>2014-05-08 11:13:08 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-05-08 11:30:36 +0200
commit9e282febfd09ad5c4f6c740975d35c37a275fea2 (patch)
tree4cc45bfe5de43c20922da9e1a345682cddeea1cb /src
parent87e9a061b5858966c2b4338d83526bf3f975301c (diff)
downloadweechat-9e282febfd09ad5c4f6c740975d35c37a275fea2.zip
relay: fix disconnection of client on empty websocket frames
WeeChat disconnects any client when a frame with length 0 is recieved.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/relay/relay-client.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c
index 6153ddfb3..63ae2ed80 100644
--- a/src/plugins/relay/relay-client.c
+++ b/src/plugins/relay/relay-client.c
@@ -488,7 +488,16 @@ relay_client_recv_cb (void *arg_client, int fd)
(unsigned long long)num_read,
(unsigned char *)decoded,
&decoded_length);
- if (!rc || (decoded_length == 0))
+ if (decoded_length == 0)
+ {
+ /* When decoded length is 0, assume client sent a PONG frame.
+ *
+ * RFC 6455 Section 5.5.3
+ * "A Pong frame MAY be sent unsolicited. This serves as a unidirectional heartbeat. A response to an unsolicited Pong frame is not expected."
+ */
+ return WEECHAT_RC_OK;
+ }
+ if (!rc)
{
/* error when decoding frame: close connection */
weechat_printf_tags (NULL, "relay_client",