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
4a4b2cf5
Commit
4a4b2cf5
authored
Oct 08, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Embed Process into OCSPUpdateContext
parent
2c2188c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
17 deletions
+15
-17
src/shrpx_connection_handler.cc
src/shrpx_connection_handler.cc
+12
-13
src/shrpx_connection_handler.h
src/shrpx_connection_handler.h
+3
-4
No files found.
src/shrpx_connection_handler.cc
View file @
4a4b2cf5
...
...
@@ -44,7 +44,6 @@
#include "shrpx_accept_handler.h"
#include "shrpx_memcached_dispatcher.h"
#include "shrpx_signal.h"
#include "shrpx_exec.h"
#include "util.h"
#include "template.h"
...
...
@@ -139,7 +138,7 @@ ConnectionHandler::ConnectionHandler(struct ev_loop *loop, std::mt19937 &gen)
ocsp_
.
chldev
.
data
=
this
;
ocsp_
.
next
=
0
;
ocsp_
.
fd
=
-
1
;
ocsp_
.
proc
.
r
fd
=
-
1
;
reset_ocsp
();
}
...
...
@@ -496,11 +495,11 @@ bool ConnectionHandler::get_graceful_shutdown() const {
}
void
ConnectionHandler
::
cancel_ocsp_update
()
{
if
(
ocsp_
.
pid
==
0
)
{
if
(
ocsp_
.
p
roc
.
p
id
==
0
)
{
return
;
}
kill
(
ocsp_
.
pid
,
SIGTERM
);
kill
(
ocsp_
.
p
roc
.
p
id
,
SIGTERM
);
}
// inspired by h2o_read_command function from h2o project:
...
...
@@ -526,13 +525,12 @@ int ConnectionHandler::start_ocsp_update(const char *cert_file) {
return
-
1
;
}
ocsp_
.
pid
=
proc
.
pid
;
ocsp_
.
fd
=
proc
.
rfd
;
ocsp_
.
proc
=
proc
;
ev_io_set
(
&
ocsp_
.
rev
,
ocsp_
.
fd
,
EV_READ
);
ev_io_set
(
&
ocsp_
.
rev
,
ocsp_
.
proc
.
r
fd
,
EV_READ
);
ev_io_start
(
loop_
,
&
ocsp_
.
rev
);
ev_child_set
(
&
ocsp_
.
chldev
,
ocsp_
.
pid
,
0
);
ev_child_set
(
&
ocsp_
.
chldev
,
ocsp_
.
p
roc
.
p
id
,
0
);
ev_child_start
(
loop_
,
&
ocsp_
.
chldev
);
return
0
;
...
...
@@ -542,7 +540,8 @@ void ConnectionHandler::read_ocsp_chunk() {
std
::
array
<
uint8_t
,
4
_k
>
buf
;
for
(;;)
{
ssize_t
n
;
while
((
n
=
read
(
ocsp_
.
fd
,
buf
.
data
(),
buf
.
size
()))
==
-
1
&&
errno
==
EINTR
)
while
((
n
=
read
(
ocsp_
.
proc
.
rfd
,
buf
.
data
(),
buf
.
size
()))
==
-
1
&&
errno
==
EINTR
)
;
if
(
n
==
-
1
)
{
...
...
@@ -614,12 +613,12 @@ void ConnectionHandler::handle_ocsp_complete() {
}
void
ConnectionHandler
::
reset_ocsp
()
{
if
(
ocsp_
.
fd
!=
-
1
)
{
close
(
ocsp_
.
fd
);
if
(
ocsp_
.
proc
.
r
fd
!=
-
1
)
{
close
(
ocsp_
.
proc
.
r
fd
);
}
ocsp_
.
fd
=
-
1
;
ocsp_
.
pid
=
0
;
ocsp_
.
proc
.
r
fd
=
-
1
;
ocsp_
.
p
roc
.
p
id
=
0
;
ocsp_
.
error
=
0
;
ocsp_
.
resp
=
std
::
vector
<
uint8_t
>
();
}
...
...
src/shrpx_connection_handler.h
View file @
4a4b2cf5
...
...
@@ -50,6 +50,7 @@
#include "shrpx_downstream_connection_pool.h"
#include "shrpx_config.h"
#include "shrpx_exec.h"
namespace
shrpx
{
...
...
@@ -71,17 +72,15 @@ class CertLookupTree;
struct
OCSPUpdateContext
{
// ocsp response buffer
std
::
vector
<
uint8_t
>
resp
;
// Process running fetch-ocsp-response script
Process
proc
;
// index to ConnectionHandler::all_ssl_ctx_, which points to next
// SSL_CTX to update ocsp response cache.
size_t
next
;
ev_child
chldev
;
ev_io
rev
;
// fd to read response from fetch-ocsp-response script
int
fd
;
// errno encountered while processing response
int
error
;
// pid of forked fetch-ocsp-response script process
pid_t
pid
;
};
// SerialEvent is an event sent from Worker thread.
...
...
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