summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2019-01-05 14:54:39 +0100
committerdequis <dx@dxzone.com.ar>2019-01-05 14:54:39 +0100
commitc612d255ec7c2699aef70b6eab10920a914c313d (patch)
treea321646dc86b98c80443a9f57a1f73f22e6e9a60
parent6d4ddb8c1d97340d8fcf1435e2ccdc328072fa1f (diff)
downloadbitlbee-facebook-c612d255ec7c2699aef70b6eab10920a914c313d.tar.gz
..properly fix "Failed to read fixed header" with TLS 1.3
Since now I can reproduce the thing (not very reliably, but often enough), I see that I was using the wrong function. ssl_pending() means stuff left in the ssl library buffer that we can read, what we want to check is EAGAIN.
-rw-r--r--facebook/facebook-mqtt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/facebook/facebook-mqtt.c b/facebook/facebook-mqtt.c
index cc51a25..01979e6 100644
--- a/facebook/facebook-mqtt.c
+++ b/facebook/facebook-mqtt.c
@@ -341,7 +341,7 @@ fb_mqtt_cb_read(gpointer data, gint fd, b_input_condition cond)
res = ssl_read(priv->ssl, (gchar *) &byte, sizeof byte);
- if (res < 0 && ssl_pending(priv->ssl)) {
+ if (res < 0 && ssl_sockerr_again(priv->ssl)) {
return TRUE;
} else if (res != 1) {
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
@@ -357,7 +357,7 @@ fb_mqtt_cb_read(gpointer data, gint fd, b_input_condition cond)
res = ssl_read(priv->ssl, (gchar *) &byte, sizeof byte);
/* TODO: this case isn't handled yet */
- if (0 && res < 0 && ssl_pending(priv->ssl)) {
+ if (0 && res < 0 && ssl_sockerr_again(priv->ssl)) {
return TRUE;
} else if (res != 1) {
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
@@ -376,7 +376,7 @@ fb_mqtt_cb_read(gpointer data, gint fd, b_input_condition cond)
size = MIN(priv->remz, sizeof buf);
rize = ssl_read(priv->ssl, (gchar *) buf, size);
- if (rize < 0 && ssl_pending(priv->ssl)) {
+ if (rize < 0 && ssl_sockerr_again(priv->ssl)) {
return TRUE;
} else if (rize < 1) {
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,