Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
folly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
folly
Commits
60331af0
Commit
60331af0
authored
Sep 16, 2015
by
Lucian Grijincu
Committed by
facebook-github-bot-1
Sep 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
folly: io: SSLContext/AsyncSSLSocket: drop global static mutex (siof)
Reviewed By: @yfeldblum Differential Revision: D2446538
parent
062f90e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
19 deletions
+17
-19
folly/io/async/AsyncSSLSocket.cpp
folly/io/async/AsyncSSLSocket.cpp
+3
-11
folly/io/async/AsyncSSLSocket.h
folly/io/async/AsyncSSLSocket.h
+0
-2
folly/io/async/SSLContext.cpp
folly/io/async/SSLContext.cpp
+14
-5
folly/io/async/SSLContext.h
folly/io/async/SSLContext.h
+0
-1
No files found.
folly/io/async/AsyncSSLSocket.cpp
View file @
60331af0
...
@@ -607,18 +607,10 @@ void AsyncSSLSocket::timeoutExpired() noexcept {
...
@@ -607,18 +607,10 @@ void AsyncSSLSocket::timeoutExpired() noexcept {
}
}
}
}
int
AsyncSSLSocket
::
sslExDataIndex_
=
-
1
;
std
::
mutex
AsyncSSLSocket
::
mutex_
;
int
AsyncSSLSocket
::
getSSLExDataIndex
()
{
int
AsyncSSLSocket
::
getSSLExDataIndex
()
{
if
(
sslExDataIndex_
<
0
)
{
static
auto
index
=
SSL_get_ex_new_index
(
std
::
lock_guard
<
std
::
mutex
>
g
(
mutex_
);
0
,
(
void
*
)
"AsyncSSLSocket data index"
,
nullptr
,
nullptr
,
nullptr
);
if
(
sslExDataIndex_
<
0
)
{
return
index
;
sslExDataIndex_
=
SSL_get_ex_new_index
(
0
,
(
void
*
)
"AsyncSSLSocket data index"
,
nullptr
,
nullptr
,
nullptr
);
}
}
return
sslExDataIndex_
;
}
}
AsyncSSLSocket
*
AsyncSSLSocket
::
getFromSSL
(
const
SSL
*
ssl
)
{
AsyncSSLSocket
*
AsyncSSLSocket
::
getFromSSL
(
const
SSL
*
ssl
)
{
...
...
folly/io/async/AsyncSSLSocket.h
View file @
60331af0
...
@@ -803,8 +803,6 @@ class AsyncSSLSocket : public virtual AsyncSocket {
...
@@ -803,8 +803,6 @@ class AsyncSSLSocket : public virtual AsyncSocket {
static
void
sslInfoCallback
(
const
SSL
*
ssl
,
int
type
,
int
val
);
static
void
sslInfoCallback
(
const
SSL
*
ssl
,
int
type
,
int
val
);
static
std
::
mutex
mutex_
;
static
int
sslExDataIndex_
;
// Whether we've applied the TCP_CORK option to the socket
// Whether we've applied the TCP_CORK option to the socket
bool
corked_
{
false
};
bool
corked_
{
false
};
// SSL related members.
// SSL related members.
...
...
folly/io/async/SSLContext.cpp
View file @
60331af0
...
@@ -35,7 +35,16 @@ struct CRYPTO_dynlock_value {
...
@@ -35,7 +35,16 @@ struct CRYPTO_dynlock_value {
namespace
folly
{
namespace
folly
{
bool
SSLContext
::
initialized_
=
false
;
bool
SSLContext
::
initialized_
=
false
;
std
::
mutex
SSLContext
::
mutex_
;
namespace
{
std
::
mutex
&
initMutex
()
{
static
std
::
mutex
m
;
return
m
;
}
}
// anonymous namespace
#ifdef OPENSSL_NPN_NEGOTIATED
#ifdef OPENSSL_NPN_NEGOTIATED
int
SSLContext
::
sNextProtocolsExDataIndex_
=
-
1
;
int
SSLContext
::
sNextProtocolsExDataIndex_
=
-
1
;
#endif
#endif
...
@@ -43,7 +52,7 @@ int SSLContext::sNextProtocolsExDataIndex_ = -1;
...
@@ -43,7 +52,7 @@ int SSLContext::sNextProtocolsExDataIndex_ = -1;
// SSLContext implementation
// SSLContext implementation
SSLContext
::
SSLContext
(
SSLVersion
version
)
{
SSLContext
::
SSLContext
(
SSLVersion
version
)
{
{
{
std
::
lock_guard
<
std
::
mutex
>
g
(
mutex_
);
std
::
lock_guard
<
std
::
mutex
>
g
(
initMutex
()
);
initializeOpenSSLLocked
();
initializeOpenSSLLocked
();
}
}
...
@@ -679,12 +688,12 @@ void SSLContext::setSSLLockTypes(std::map<int, SSLLockType> inLockTypes) {
...
@@ -679,12 +688,12 @@ void SSLContext::setSSLLockTypes(std::map<int, SSLLockType> inLockTypes) {
}
}
void
SSLContext
::
markInitialized
()
{
void
SSLContext
::
markInitialized
()
{
std
::
lock_guard
<
std
::
mutex
>
g
(
mutex_
);
std
::
lock_guard
<
std
::
mutex
>
g
(
initMutex
()
);
initialized_
=
true
;
initialized_
=
true
;
}
}
void
SSLContext
::
initializeOpenSSL
()
{
void
SSLContext
::
initializeOpenSSL
()
{
std
::
lock_guard
<
std
::
mutex
>
g
(
mutex_
);
std
::
lock_guard
<
std
::
mutex
>
g
(
initMutex
()
);
initializeOpenSSLLocked
();
initializeOpenSSLLocked
();
}
}
...
@@ -715,7 +724,7 @@ void SSLContext::initializeOpenSSLLocked() {
...
@@ -715,7 +724,7 @@ void SSLContext::initializeOpenSSLLocked() {
}
}
void
SSLContext
::
cleanupOpenSSL
()
{
void
SSLContext
::
cleanupOpenSSL
()
{
std
::
lock_guard
<
std
::
mutex
>
g
(
mutex_
);
std
::
lock_guard
<
std
::
mutex
>
g
(
initMutex
()
);
cleanupOpenSSLLocked
();
cleanupOpenSSLLocked
();
}
}
...
...
folly/io/async/SSLContext.h
View file @
60331af0
...
@@ -431,7 +431,6 @@ class SSLContext {
...
@@ -431,7 +431,6 @@ class SSLContext {
std
::
vector
<
ClientHelloCallback
>
clientHelloCbs_
;
std
::
vector
<
ClientHelloCallback
>
clientHelloCbs_
;
#endif
#endif
static
std
::
mutex
mutex_
;
static
bool
initialized_
;
static
bool
initialized_
;
#ifdef OPENSSL_NPN_NEGOTIATED
#ifdef OPENSSL_NPN_NEGOTIATED
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment