From: David Woodhouse Date: Fri, 3 Aug 2012 09:11:54 +0000 (+0100) Subject: Fix CSTP write stall handling X-Git-Tag: v4.07~6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fddb099d9f6c25d5500b176d6523818bd683bbae;p=users%2Fdwmw2%2Fopenconnect.git Fix CSTP write stall handling We were handling the -EAGAIN case as a hard error and tearing down the connection. Instead, we should just wait for the socket to become writeable. Signed-off-by: David Woodhouse --- diff --git a/cstp.c b/cstp.c index bb15e9c9..0588959e 100644 --- a/cstp.c +++ b/cstp.c @@ -803,11 +803,18 @@ int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout) ret = cstp_write(vpninfo, vpninfo->current_ssl_pkt->hdr, vpninfo->current_ssl_pkt->len + 8); - if (ret < 0) goto do_reconnect; - else if (!ret && ka_stalled_dpd_time(&vpninfo->ssl_times, timeout)) - goto peer_dead; + else if (!ret) { + /* -EAGAIN: cstp_write() will have added the SSL fd to + ->select_wfds if appropriate, so we can just return + and wait. Unless it's been stalled for so long that + DPD kicks in and we kill the connection. */ + if (ka_stalled_dpd_time(&vpninfo->ssl_times, timeout)) + goto peer_dead; + + return work_done; + } if (ret != vpninfo->current_ssl_pkt->len + 8) { vpn_progress(vpninfo, PRG_ERR, diff --git a/www/changelog.xml b/www/changelog.xml index d439ced7..7a836796 100644 --- a/www/changelog.xml +++ b/www/changelog.xml @@ -17,7 +17,7 @@