Browse code

tls: fix partial write on write-wants-read queue flush

When flushing the queue the SSL_write() should be retried until
the queue is empty or there is an error (SSL_WANT_READ or
SSL_WANT_WRITE), since it is possible to have partial writes
smaller then the block size (SSL_write() will write at most 1
record when partial writes are enabled and with the
ssl_max_send_fragment option it is possible to set/have record
sizes smaller then typical writes).

Andrei Pelinescu-Onciul authored on 15/08/2010 23:12:41
Showing 1 changed files
... ...
@@ -265,7 +265,8 @@ inline static int sbufq_flush(struct sbuffer_queue* q, int* flags,
265 265
 			}else{
266 266
 				q->offset+=n;
267 267
 				q->queued-=n;
268
-				break;
268
+				/* no break: if we are here n < block_size => partial write
269
+				   => the write should be retried */
269 270
 			}
270 271
 		}else{
271 272
 			if (unlikely(n<0))