Lines 64-79
Link Here
|
64 |
|
64 |
|
65 |
int ssl_mutex_init(server_rec *s, apr_pool_t *p) |
65 |
int ssl_mutex_init(server_rec *s, apr_pool_t *p) |
66 |
{ |
66 |
{ |
|
|
67 |
apr_status_t status; |
67 |
SSLModConfigRec *mc = myModConfig(s); |
68 |
SSLModConfigRec *mc = myModConfig(s); |
68 |
|
69 |
|
69 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
70 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
70 |
return TRUE; |
71 |
return TRUE; |
71 |
|
72 |
|
72 |
if (apr_global_mutex_create(&mc->pMutex, mc->szMutexFile, |
73 |
ssl_log(s, SSL_LOG_DEBUG, "Create global mutex lock with mech #%d", mc->nMutexMech); |
73 |
APR_LOCK_DEFAULT, p) != APR_SUCCESS) { |
74 |
|
74 |
ssl_log(s, SSL_LOG_ERROR, |
75 |
status = apr_global_mutex_create(&mc->pMutex, mc->szMutexFile, APR_LOCK_DEFAULT, p); |
75 |
"Cannot create SSLMutex file `%s'", |
76 |
if (status != APR_SUCCESS) { |
76 |
mc->szMutexFile); |
77 |
char buf[120]; |
|
|
78 |
|
79 |
apr_strerror(status, buf, sizeof(buf)); |
80 |
if (mc->szMutexFile) |
81 |
ssl_log(s, SSL_LOG_ERROR, |
82 |
"Failed to create global mutex lock using file `%s': %s", |
83 |
mc->szMutexFile, buf); |
84 |
else |
85 |
ssl_log(s, SSL_LOG_ERROR, |
86 |
"Failed to create global mutex lock: %s", buf); |
87 |
|
77 |
return FALSE; |
88 |
return FALSE; |
78 |
} |
89 |
} |
79 |
return TRUE; |
90 |
return TRUE; |
Lines 81-105
Link Here
|
81 |
|
92 |
|
82 |
int ssl_mutex_reinit(server_rec *s, apr_pool_t *p) |
93 |
int ssl_mutex_reinit(server_rec *s, apr_pool_t *p) |
83 |
{ |
94 |
{ |
|
|
95 |
apr_status_t status; |
84 |
SSLModConfigRec *mc = myModConfig(s); |
96 |
SSLModConfigRec *mc = myModConfig(s); |
85 |
|
97 |
|
86 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
98 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
87 |
return TRUE; |
99 |
return TRUE; |
88 |
|
100 |
|
89 |
if (apr_global_mutex_child_init(&mc->pMutex, |
101 |
status = apr_global_mutex_child_init(&mc->pMutex, mc->szMutexFile, p); |
90 |
mc->szMutexFile, p) != APR_SUCCESS) |
102 |
if (status != APR_SUCCESS) { |
|
|
103 |
char buf[120]; |
104 |
ssl_log(s, SSL_LOG_WARN, "Failed to reinit global mutex lock: %s", |
105 |
apr_strerror(status, buf, sizeof(buf))); |
91 |
return FALSE; |
106 |
return FALSE; |
|
|
107 |
} |
92 |
return TRUE; |
108 |
return TRUE; |
93 |
} |
109 |
} |
94 |
|
110 |
|
95 |
int ssl_mutex_on(server_rec *s) |
111 |
int ssl_mutex_on(server_rec *s) |
96 |
{ |
112 |
{ |
|
|
113 |
apr_status_t status; |
97 |
SSLModConfigRec *mc = myModConfig(s); |
114 |
SSLModConfigRec *mc = myModConfig(s); |
98 |
|
115 |
|
99 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
116 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
100 |
return TRUE; |
117 |
return TRUE; |
101 |
if (apr_global_mutex_lock(mc->pMutex) != APR_SUCCESS) { |
118 |
|
102 |
ssl_log(s, SSL_LOG_WARN, "Failed to acquire global mutex lock"); |
119 |
status = apr_global_mutex_lock(mc->pMutex); |
|
|
120 |
if (status != APR_SUCCESS) { |
121 |
char buf[120]; |
122 |
ssl_log(s, SSL_LOG_WARN, "Failed to acquire global mutex lock: %s", |
123 |
apr_strerror(status, buf, sizeof(buf))); |
103 |
return FALSE; |
124 |
return FALSE; |
104 |
} |
125 |
} |
105 |
return TRUE; |
126 |
return TRUE; |
Lines 107-118
Link Here
|
107 |
|
128 |
|
108 |
int ssl_mutex_off(server_rec *s) |
129 |
int ssl_mutex_off(server_rec *s) |
109 |
{ |
130 |
{ |
|
|
131 |
apr_status_t status; |
110 |
SSLModConfigRec *mc = myModConfig(s); |
132 |
SSLModConfigRec *mc = myModConfig(s); |
111 |
|
133 |
|
112 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
134 |
if (mc->nMutexMode == SSL_MUTEXMODE_NONE) |
113 |
return TRUE; |
135 |
return TRUE; |
114 |
if (apr_global_mutex_unlock(mc->pMutex) != APR_SUCCESS) { |
136 |
|
115 |
ssl_log(s, SSL_LOG_WARN, "Failed to release global mutex lock"); |
137 |
status = apr_global_mutex_unlock(mc->pMutex); |
|
|
138 |
if (status != APR_SUCCESS) { |
139 |
char buf[120]; |
140 |
ssl_log(s, SSL_LOG_WARN, "Failed to release global mutex lock: %s", |
141 |
apr_strerror(status, buf, sizeof(buf))); |
116 |
return FALSE; |
142 |
return FALSE; |
117 |
} |
143 |
} |
118 |
return TRUE; |
144 |
return TRUE; |