diff options
Diffstat (limited to 'push.c')
-rw-r--r-- | push.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -187,8 +187,9 @@ send_push_reply (struct context *c) static char cmd[] = "PUSH_REPLY"; const int extra = 64; /* extra space for possible trailing ifconfig and push-continuation */ const int safe_cap = BCAP (&buf) - extra; + bool push_sent = false; - buf_printf (&buf, cmd); + buf_printf (&buf, "%s", cmd); while (e) { @@ -202,9 +203,10 @@ send_push_reply (struct context *c) const bool status = send_control_channel_string (c, BSTR (&buf), D_PUSH); if (!status) goto fail; + push_sent = true; multi_push = true; buf_reset_len (&buf); - buf_printf (&buf, cmd); + buf_printf (&buf, "%s", cmd); } } if (BLEN (&buf) + l >= safe_cap) @@ -228,6 +230,21 @@ send_push_reply (struct context *c) { const bool status = send_control_channel_string (c, BSTR (&buf), D_PUSH); if (!status) + goto fail; + push_sent = true; + } + + /* If nothing have been pushed, send an empty push, + * as the client is expecting a response + */ + if (!push_sent) + { + bool status = false; + + buf_reset_len (&buf); + buf_printf (&buf, "%s", cmd); + status = send_control_channel_string (c, BSTR(&buf), D_PUSH); + if (!status) goto fail; } |