From 36dcd56f27f3cf82eaec3ece7e964b75c21bff11 Mon Sep 17 00:00:00 2001 From: Alexander Vdolainen Date: Mon, 22 Feb 2016 18:09:29 +0200 Subject: [PATCH] [core] bugfix with ssl read; --- lib/sxmplv2.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/sxmplv2.c b/lib/sxmplv2.c index 60ccecd..622125f 100644 --- a/lib/sxmplv2.c +++ b/lib/sxmplv2.c @@ -777,7 +777,15 @@ static void *__sxmpl_thread(void *b) gettimeofday(&beg, NULL); #endif memset(mhead, 0, sizeof(sxmplv2_head_t)); - rd = __conn_read(co, mhead, sizeof(sxmplv2_head_t)); + total_rd = 0; + while(total_rd != sizeof(sxmplv2_head_t)) { + total_rd += __conn_read(co, buf + total_rd, sizeof(sxmplv2_head_t) - total_rd); + if(total_rd == -1) { + co->flags |= SXMP_CLOSED; + break; + } + } + rd = total_rd; #ifdef _PERFPROFILE gettimeofday(&end, NULL); @@ -808,7 +816,7 @@ static void *__sxmpl_thread(void *b) #endif total_rd = 0; while(total_rd != mhead->payload_length) { - total_rd += __conn_read(co, bbuf + total_rd, mhead->payload_length); + total_rd += __conn_read(co, bbuf + total_rd, mhead->payload_length - total_rd); if(total_rd == -1) goto __sslproto_error; } rd = total_rd;