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 */
static SnifferServer* ServerList = 0;
static wolfSSL_Mutex ServerListMutex;
static WOLFSSL_SHARED SnifferServer* ServerList = 0;
static WOLFSSL_SHARED wolfSSL_Mutex ServerListMutex;
/* Session Hash Table, mutex, and count */
static SnifferSession* SessionTable[HASH_SIZE];
static wolfSSL_Mutex SessionMutex;
static int SessionCount = 0;
static WOLFSSL_SHARED SnifferSession* SessionTable[HASH_SIZE];
static WOLFSSL_SHARED wolfSSL_Mutex SessionMutex;
static WOLFSSL_SHARED int SessionCount = 0;
/* Recovery of missed data switches and stats */
static wolfSSL_Mutex RecoveryMutex; /* for stats */
static int RecoveryEnabled = 0; /* global switch */
static int MaxRecoveryMemory = -1; /* per session max recovery memory */
static word32 MissedDataSessions = 0; /* # of sessions with missed data */
static WOLFSSL_SHARED wolfSSL_Mutex RecoveryMutex; /* for stats */
static WOLFSSL_SHARED int RecoveryEnabled = 0; /* global switch */
static WOLFSSL_SHARED int MaxRecoveryMemory = -1;
/* per session max recovery memory */
static WOLFSSL_SHARED word32 MissedDataSessions = 0;
/* # of sessions with missed data */
/* Connection Info Callback */
static SSLConnCb ConnectionCb;
static void* ConnectionCbCtx = NULL;
static WOLFSSL_SHARED SSLConnCb ConnectionCb;
static WOLFSSL_SHARED void* ConnectionCbCtx = NULL;
#ifdef WOLFSSL_SNIFFER_STATS
/* Sessions Statistics */
static SSLStats SnifferStats;
static wolfSSL_Mutex StatsMutex;
static WOLFSSL_SHARED SSLStats SnifferStats;
static WOLFSSL_SHARED wolfSSL_Mutex StatsMutex;
#endif
#ifdef WOLFSSL_SNIFFER_WATCH
/* Watch Key Callback */
static SSLWatchCb WatchCb;
static void* WatchCbCtx = NULL;
static WOLFSSL_SHARED SSLWatchCb WatchCb;
static WOLFSSL_SHARED void* WatchCbCtx = NULL;
#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];
} SessionRow;
static SessionRow SessionCache[SESSION_ROWS];
static WOLFSSL_SHARED SessionRow SessionCache[SESSION_ROWS];
#if defined(WOLFSSL_SESSION_STATS) && defined(WOLFSSL_PEAK_SESSIONS)
static word32 PeakSessions;
static WOLFSSL_SHARED word32 PeakSessions;
#endif
static wolfSSL_Mutex session_mutex; /* SessionCache mutex */
static WOLFSSL_SHARED wolfSSL_Mutex session_mutex; /* SessionCache mutex */
#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];
} ClientRow;
static ClientRow ClientCache[SESSION_ROWS]; /* Client Cache */
static WOLFSSL_SHARED ClientRow ClientCache[SESSION_ROWS];
/* Client Cache */
/* uses session mutex */
#endif /* NO_CLIENT_CACHE */