Skip to content

Commit

Permalink
Fix CSTP write stall handling
Browse files Browse the repository at this point in the history
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 <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Aug 3, 2012
1 parent 219a3d2 commit fddb099
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions cstp.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion www/changelog.xml
Expand Up @@ -17,7 +17,7 @@
<ul>
<li><b>OpenConnect HEAD</b>
<ul>
<li><i>No changelog entries yet</i></li>
<li>Fix handling of write stalls on CSTP (TCP) socket.</li>
</ul><br/>
</li>
<li><b><a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-4.06.tar.gz">OpenConnect v4.06</a></b>
Expand Down

0 comments on commit fddb099

Please sign in to comment.