websockets: continue logging in on SSL_AGAIN

It is possible for ssl_read to fail with SSL_AGAIN errno and in this
case we should just continue logging in instead of failing right away.
This commit is contained in:
Artem Savkov 2018-11-14 19:42:04 +01:00
parent 8eee0b713f
commit 10073221cc
1 changed files with 3 additions and 1 deletions

View File

@ -182,7 +182,9 @@ static gboolean discord_ws_in_cb(gpointer data, int source,
if (dd->state == WS_CONNECTING) {
gchar buf[4096] = "";
if (ssl_read(dd->ssl, buf, sizeof(buf)) < 1) {
imcb_error(ic, "Failed to do ssl_read while switching to websocket mode");
if (ssl_errno == SSL_AGAIN)
return TRUE;
imcb_error(ic, "Failed to do ssl_read while switching to websocket mode: %d", ssl_errno);
imc_logout(ic, TRUE);
return FALSE;
}