aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-11-19 13:35:46 -0300
committerdequis <dx@dxzone.com.ar>2015-11-19 13:44:08 -0300
commite91ef973e98e8b2bb1f60f057a87d20994aac2a0 (patch)
tree2be59152ff6931d5b6fe94d0ee21fd7a8d5be346
parentf2ca48a6f79f41b9d1e29016e2cd6b9c5df39089 (diff)
downloadbitlbee-facebook-e91ef973e98e8b2bb1f60f057a87d20994aac2a0.tar.gz
bitlbee-facebook-e91ef973e98e8b2bb1f60f057a87d20994aac2a0.tar.bz2
bitlbee-facebook-e91ef973e98e8b2bb1f60f057a87d20994aac2a0.tar.xz
fb_mqtt_write: fix unreachable input_add (priv->wev was always 0)
This was the only line that assigned anything to priv->wev, and it was behind an (incorrect) condition that checked if it's nonzero. That would have replaced priv->wev if the condition was ever true, but since it wasn't, the only result is potentially delayed writes (for example, filling the write buffer and only writing the rest a minute later when pinging the server) The new condition also checks the return value of fb_mqtt_cb_write(), which is true if it should continue writing, or false otherwise.
-rw-r--r--facebook/facebook-mqtt.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/facebook/facebook-mqtt.c b/facebook/facebook-mqtt.c
index de0fee6..ab3589c 100644
--- a/facebook/facebook-mqtt.c
+++ b/facebook/facebook-mqtt.c
@@ -549,9 +549,8 @@ fb_mqtt_write(FbMqtt *mqtt, FbMqttMessage *msg)
fd = ssl_getfd(priv->ssl);
g_byte_array_append(priv->wbuf, bytes->data, bytes->len);
- fb_mqtt_cb_write(mqtt, fd, B_EV_IO_WRITE);
- if (priv->wev > 0) {
+ if (fb_mqtt_cb_write(mqtt, fd, B_EV_IO_WRITE) && (priv->wev < 1)) {
priv->wev = b_input_add(fd, B_EV_IO_WRITE, fb_mqtt_cb_write, mqtt);
}
}