Updated some more globals in the sniffer and session cache with being shared.

This commit is contained in:
John Safranek
2019-07-11 17:39:54 -05:00
parent a991cc42f4
commit bbc208ad33
2 changed files with 22 additions and 19 deletions

View File

@@ -404,35 +404,37 @@ typedef struct SnifferSession {
/* Sniffer Server List and mutex */ /* Sniffer Server List and mutex */
static SnifferServer* ServerList = 0; static WOLFSSL_SHARED SnifferServer* ServerList = 0;
static wolfSSL_Mutex ServerListMutex; static WOLFSSL_SHARED wolfSSL_Mutex ServerListMutex;
/* Session Hash Table, mutex, and count */ /* Session Hash Table, mutex, and count */
static SnifferSession* SessionTable[HASH_SIZE]; static WOLFSSL_SHARED SnifferSession* SessionTable[HASH_SIZE];
static wolfSSL_Mutex SessionMutex; static WOLFSSL_SHARED wolfSSL_Mutex SessionMutex;
static int SessionCount = 0; static WOLFSSL_SHARED int SessionCount = 0;
/* Recovery of missed data switches and stats */ /* Recovery of missed data switches and stats */
static wolfSSL_Mutex RecoveryMutex; /* for stats */ static WOLFSSL_SHARED wolfSSL_Mutex RecoveryMutex; /* for stats */
static int RecoveryEnabled = 0; /* global switch */ static WOLFSSL_SHARED int RecoveryEnabled = 0; /* global switch */
static int MaxRecoveryMemory = -1; /* per session max recovery memory */ static WOLFSSL_SHARED int MaxRecoveryMemory = -1;
static word32 MissedDataSessions = 0; /* # of sessions with missed data */ /* per session max recovery memory */
static WOLFSSL_SHARED word32 MissedDataSessions = 0;
/* # of sessions with missed data */
/* Connection Info Callback */ /* Connection Info Callback */
static SSLConnCb ConnectionCb; static WOLFSSL_SHARED SSLConnCb ConnectionCb;
static void* ConnectionCbCtx = NULL; static WOLFSSL_SHARED void* ConnectionCbCtx = NULL;
#ifdef WOLFSSL_SNIFFER_STATS #ifdef WOLFSSL_SNIFFER_STATS
/* Sessions Statistics */ /* Sessions Statistics */
static SSLStats SnifferStats; static WOLFSSL_SHARED SSLStats SnifferStats;
static wolfSSL_Mutex StatsMutex; static WOLFSSL_SHARED wolfSSL_Mutex StatsMutex;
#endif #endif
#ifdef WOLFSSL_SNIFFER_WATCH #ifdef WOLFSSL_SNIFFER_WATCH
/* Watch Key Callback */ /* Watch Key Callback */
static SSLWatchCb WatchCb; static WOLFSSL_SHARED SSLWatchCb WatchCb;
static void* WatchCbCtx = NULL; static WOLFSSL_SHARED void* WatchCbCtx = NULL;
#endif #endif

View File

@@ -4658,13 +4658,13 @@ int AddCA(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int type, int verify)
WOLFSSL_SESSION Sessions[SESSIONS_PER_ROW]; WOLFSSL_SESSION Sessions[SESSIONS_PER_ROW];
} SessionRow; } SessionRow;
static SessionRow SessionCache[SESSION_ROWS]; static WOLFSSL_SHARED SessionRow SessionCache[SESSION_ROWS];
#if defined(WOLFSSL_SESSION_STATS) && defined(WOLFSSL_PEAK_SESSIONS) #if defined(WOLFSSL_SESSION_STATS) && defined(WOLFSSL_PEAK_SESSIONS)
static word32 PeakSessions; static WOLFSSL_SHARED word32 PeakSessions;
#endif #endif
static wolfSSL_Mutex session_mutex; /* SessionCache mutex */ static WOLFSSL_SHARED wolfSSL_Mutex session_mutex; /* SessionCache mutex */
#ifndef NO_CLIENT_CACHE #ifndef NO_CLIENT_CACHE
@@ -4679,7 +4679,8 @@ int AddCA(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int type, int verify)
ClientSession Clients[SESSIONS_PER_ROW]; ClientSession Clients[SESSIONS_PER_ROW];
} ClientRow; } ClientRow;
static ClientRow ClientCache[SESSION_ROWS]; /* Client Cache */ static WOLFSSL_SHARED ClientRow ClientCache[SESSION_ROWS];
/* Client Cache */
/* uses session mutex */ /* uses session mutex */
#endif /* NO_CLIENT_CACHE */ #endif /* NO_CLIENT_CACHE */