You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
52 lines
1.4 KiB
7 years ago
|
--- a/pidgin/libpurple/protocols/facebook/mqtt.c
|
||
|
+++ b/pidgin/libpurple/protocols/facebook/mqtt.c
|
||
|
@@ -361,26 +361,33 @@
|
||
|
g_byte_array_set_size(priv->rbuf, 0);
|
||
|
|
||
|
res = purple_ssl_read(priv->gsc, &byte, sizeof byte);
|
||
|
- g_byte_array_append(priv->rbuf, &byte, sizeof byte);
|
||
|
|
||
|
- if (res != sizeof byte) {
|
||
|
+ if (res < 0 && errno == EAGAIN) {
|
||
|
+ return;
|
||
|
+ } else if (res != 1) {
|
||
|
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
|
||
|
_("Failed to read fixed header"));
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
+ g_byte_array_append(priv->rbuf, &byte, sizeof byte);
|
||
|
+
|
||
|
mult = 1;
|
||
|
|
||
|
do {
|
||
|
res = purple_ssl_read(priv->gsc, &byte, sizeof byte);
|
||
|
- g_byte_array_append(priv->rbuf, &byte, sizeof byte);
|
||
|
|
||
|
- if (res != sizeof byte) {
|
||
|
+ /* TODO: this case isn't handled yet */
|
||
|
+ if (0 && res < 0 && errno == EAGAIN) {
|
||
|
+ return;
|
||
|
+ } else if (res != 1) {
|
||
|
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
|
||
|
_("Failed to read packet size"));
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
+ g_byte_array_append(priv->rbuf, &byte, sizeof byte);
|
||
|
+
|
||
|
priv->remz += (byte & 127) * mult;
|
||
|
mult *= 128;
|
||
|
} while ((byte & 128) != 0);
|
||
|
@@ -390,7 +397,9 @@
|
||
|
size = MIN(priv->remz, sizeof buf);
|
||
|
rize = purple_ssl_read(priv->gsc, buf, size);
|
||
|
|
||
|
- if (rize < 1) {
|
||
|
+ if (rize < 0 && errno == EAGAIN) {
|
||
|
+ return;
|
||
|
+ } else if (rize < 1) {
|
||
|
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
|
||
|
_("Failed to read packet data"));
|
||
|
return;
|