From 4954043def7bd0faa4076d9feaaec42fe8995a8c Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 1 Dec 2014 14:11:32 -0800 Subject: [PATCH] release lock on client side cache bad hash --- src/ssl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 511c8e229..42ef50403 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -5777,16 +5777,16 @@ int AddSession(CYASSL* ssl) &error) % SESSION_ROWS; if (error != 0) { CYASSL_MSG("Hash session failed"); - return error; + } else { + clientIdx = ClientCache[clientRow].nextIdx++; + + ClientCache[clientRow].Clients[clientIdx].serverRow = (word16)row; + ClientCache[clientRow].Clients[clientIdx].serverIdx = (word16)idx; + + ClientCache[clientRow].totalCount++; + if (ClientCache[clientRow].nextIdx == SESSIONS_PER_ROW) + ClientCache[clientRow].nextIdx = 0; } - clientIdx = ClientCache[clientRow].nextIdx++; - - ClientCache[clientRow].Clients[clientIdx].serverRow = (word16)row; - ClientCache[clientRow].Clients[clientIdx].serverIdx = (word16)idx; - - ClientCache[clientRow].totalCount++; - if (ClientCache[clientRow].nextIdx == SESSIONS_PER_ROW) - ClientCache[clientRow].nextIdx = 0; } else SessionCache[row].Sessions[idx].idLen = 0; @@ -5795,7 +5795,7 @@ int AddSession(CYASSL* ssl) if (UnLockMutex(&session_mutex) != 0) return BAD_MUTEX_E; - return 0; + return error; }