[PATCH] Try again if SSL_write() fails to write

Murilo Opsfelder Araujo muriloo at linux.vnet.ibm.com
Fri Aug 3 08:41:52 EDT 2012


From: David Woodhouse <David.Woodhouse at intel.com>

There are cases that SSL_write() returns SSL_ERROR_WANT_WRITE when, for
instance, the socket buffer is full and could not write.  This causes
openconnect to terminate and send BYE packet.

This patch forces openconnect to try again until timeout is reached.

Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
Signed-off-by: Murilo Opsfelder Araujo <muriloo at linux.vnet.ibm.com>
---
 cstp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cstp.c b/cstp.c
index bb15e9c..88442ac 100644
--- a/cstp.c
+++ b/cstp.c
@@ -808,6 +808,10 @@ int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout)
 			goto do_reconnect;
 		else if (!ret && ka_stalled_dpd_time(&vpninfo->ssl_times, timeout))
 			goto peer_dead;
+		else if (!ret) {
+			/* Try again */
+			return work_done;
+		}
 
 		if (ret != vpninfo->current_ssl_pkt->len + 8) {
 			vpn_progress(vpninfo, PRG_ERR,
-- 
1.7.12.rc1




More information about the openconnect-devel mailing list