Explorar o código

tls: use multiprocess-safe shm_available()

under high load, the values returned by shm_available() can be inconsistent.
Use safe_shm_available() instead.
Camille Oudot %!s(int64=10) %!d(string=hai) anos
pai
achega
1fe36fa983
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      modules/tls/tls_server.c

+ 2 - 2
modules/tls/tls_server.c

@@ -59,10 +59,10 @@ int tls_run_event_routes(struct tcp_connection *c);
 /* low memory treshold for openssl bug #1491 workaround */
 /* low memory treshold for openssl bug #1491 workaround */
 #define LOW_MEM_NEW_CONNECTION_TEST() \
 #define LOW_MEM_NEW_CONNECTION_TEST() \
 	(cfg_get(tls, tls_cfg, low_mem_threshold1) && \
 	(cfg_get(tls, tls_cfg, low_mem_threshold1) && \
-	  (shm_available() < cfg_get(tls, tls_cfg, low_mem_threshold1)))
+	  (safe_shm_available() < cfg_get(tls, tls_cfg, low_mem_threshold1)))
 #define LOW_MEM_CONNECTED_TEST() \
 #define LOW_MEM_CONNECTED_TEST() \
 	(cfg_get(tls, tls_cfg, low_mem_threshold2) && \
 	(cfg_get(tls, tls_cfg, low_mem_threshold2) && \
-	  (shm_available() <  cfg_get(tls, tls_cfg, low_mem_threshold2)))
+	  (safe_shm_available() <  cfg_get(tls, tls_cfg, low_mem_threshold2)))
 
 
 #define TLS_RD_MBUF_SZ	65536
 #define TLS_RD_MBUF_SZ	65536
 #define TLS_WR_MBUF_SZ	65536
 #define TLS_WR_MBUF_SZ	65536