Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
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
nghttp2
Commits
00175eac
Commit
00175eac
authored
Feb 11, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Use Address* as a key for client side session cache
parent
396dde13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+2
-2
src/shrpx_worker.cc
src/shrpx_worker.cc
+2
-2
src/shrpx_worker.h
src/shrpx_worker.h
+11
-12
No files found.
src/shrpx_http_downstream_connection.cc
View file @
00175eac
...
...
@@ -133,7 +133,7 @@ HttpDownstreamConnection::~HttpDownstreamConnection() {
if
(
conn_
.
tls
.
ssl
)
{
auto
session
=
SSL_get1_session
(
conn_
.
tls
.
ssl
);
if
(
session
)
{
worker_
->
cache_downstream_tls_session
(
addr_
,
session
);
worker_
->
cache_downstream_tls_session
(
&
addr_
->
addr
,
session
);
}
}
}
...
...
@@ -218,7 +218,7 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
SSL_set_tlsext_host_name
(
conn_
.
tls
.
ssl
,
sni_name
.
c_str
());
}
auto
session
=
worker_
->
reuse_downstream_tls_session
(
addr_
);
auto
session
=
worker_
->
reuse_downstream_tls_session
(
&
addr_
->
addr
);
if
(
session
)
{
SSL_set_session
(
conn_
.
tls
.
ssl
,
session
);
SSL_SESSION_free
(
session
);
...
...
src/shrpx_worker.cc
View file @
00175eac
...
...
@@ -307,7 +307,7 @@ mruby::MRubyContext *Worker::get_mruby_context() const {
}
#endif // HAVE_MRUBY
void
Worker
::
cache_downstream_tls_session
(
const
DownstreamAddr
*
addr
,
void
Worker
::
cache_downstream_tls_session
(
const
Address
*
addr
,
SSL_SESSION
*
session
)
{
auto
&
tlsconf
=
get_config
()
->
tls
;
...
...
@@ -341,7 +341,7 @@ void Worker::cache_downstream_tls_session(const DownstreamAddr *addr,
++
downstream_tls_session_cache_size_
;
}
SSL_SESSION
*
Worker
::
reuse_downstream_tls_session
(
const
DownstreamAddr
*
addr
)
{
SSL_SESSION
*
Worker
::
reuse_downstream_tls_session
(
const
Address
*
addr
)
{
auto
it
=
downstream_tls_session_cache_
.
find
(
addr
);
if
(
it
==
std
::
end
(
downstream_tls_session_cache_
))
{
return
nullptr
;
...
...
src/shrpx_worker.h
View file @
00175eac
...
...
@@ -145,16 +145,15 @@ public:
mruby
::
MRubyContext
*
get_mruby_context
()
const
;
#endif // HAVE_MRUBY
// Caches |session| which is associated to downstream address
// |addr|. The caller is responsible to increment the reference
// count of |session|, since this function does not do so.
void
cache_downstream_tls_session
(
const
DownstreamAddr
*
addr
,
SSL_SESSION
*
session
);
// Caches |session| which is associated to remote address |addr|.
// The caller is responsible to increment the reference count of
// |session|, since this function does not do so.
void
cache_downstream_tls_session
(
const
Address
*
addr
,
SSL_SESSION
*
session
);
// Returns cached session associated |addr|. If non-nullptr value
// is returned, its cache entry was successfully removed from cache.
// If no cache entry is found associated to |addr|, nullptr will be
// returned.
SSL_SESSION
*
reuse_downstream_tls_session
(
const
DownstreamAddr
*
addr
);
SSL_SESSION
*
reuse_downstream_tls_session
(
const
Address
*
addr
);
private:
#ifndef NOTHREADS
...
...
@@ -170,12 +169,12 @@ private:
WorkerStat
worker_stat_
;
std
::
vector
<
DownstreamGroup
>
dgrps_
;
// C
ache for SSL_SESSION for downstream connections. SSL_SESSION is
//
associated to downstream address. One address has multiple
//
SSL_SESSION objects. New SSL_SESSION is appended to the deque.
//
When doing eviction due to storage limitation, the SSL_SESSION
//
which sits at the
front of deque is removed.
std
::
unordered_map
<
const
DownstreamAddr
*
,
std
::
deque
<
SSL_SESSION
*>>
// C
lient side SSL_SESSION cache. SSL_SESSION is associated to
//
remote address. One address has multiple SSL_SESSION objects.
//
New SSL_SESSION is appended to the deque. When doing eviction
//
due to storage limitation, the SSL_SESSION which sits at the
// front of deque is removed.
std
::
unordered_map
<
const
Address
*
,
std
::
deque
<
SSL_SESSION
*>>
downstream_tls_session_cache_
;
size_t
downstream_tls_session_cache_size_
;
...
...
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