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
1daf9ce8
Commit
1daf9ce8
authored
Oct 17, 2018
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Convert WorkerEventType to enum class
parent
d68edf56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
src/shrpx_connection_handler.cc
src/shrpx_connection_handler.cc
+4
-4
src/shrpx_worker.cc
src/shrpx_worker.cc
+8
-8
src/shrpx_worker.h
src/shrpx_worker.h
+1
-1
No files found.
src/shrpx_connection_handler.cc
View file @
1daf9ce8
...
@@ -183,7 +183,7 @@ void ConnectionHandler::set_ticket_keys_to_worker(
...
@@ -183,7 +183,7 @@ void ConnectionHandler::set_ticket_keys_to_worker(
void
ConnectionHandler
::
worker_reopen_log_files
()
{
void
ConnectionHandler
::
worker_reopen_log_files
()
{
WorkerEvent
wev
{};
WorkerEvent
wev
{};
wev
.
type
=
REOPEN_LOG
;
wev
.
type
=
WorkerEventType
::
REOPEN_LOG
;
for
(
auto
&
worker
:
workers_
)
{
for
(
auto
&
worker
:
workers_
)
{
worker
->
send
(
wev
);
worker
->
send
(
wev
);
...
@@ -194,7 +194,7 @@ void ConnectionHandler::worker_replace_downstream(
...
@@ -194,7 +194,7 @@ void ConnectionHandler::worker_replace_downstream(
std
::
shared_ptr
<
DownstreamConfig
>
downstreamconf
)
{
std
::
shared_ptr
<
DownstreamConfig
>
downstreamconf
)
{
WorkerEvent
wev
{};
WorkerEvent
wev
{};
wev
.
type
=
REPLACE_DOWNSTREAM
;
wev
.
type
=
WorkerEventType
::
REPLACE_DOWNSTREAM
;
wev
.
downstreamconf
=
std
::
move
(
downstreamconf
);
wev
.
downstreamconf
=
std
::
move
(
downstreamconf
);
for
(
auto
&
worker
:
workers_
)
{
for
(
auto
&
worker
:
workers_
)
{
...
@@ -348,7 +348,7 @@ void ConnectionHandler::graceful_shutdown_worker() {
...
@@ -348,7 +348,7 @@ void ConnectionHandler::graceful_shutdown_worker() {
}
}
WorkerEvent
wev
{};
WorkerEvent
wev
{};
wev
.
type
=
GRACEFUL_SHUTDOWN
;
wev
.
type
=
WorkerEventType
::
GRACEFUL_SHUTDOWN
;
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
LLOG
(
INFO
,
this
)
<<
"Sending graceful shutdown signal to worker"
;
LLOG
(
INFO
,
this
)
<<
"Sending graceful shutdown signal to worker"
;
...
@@ -432,7 +432,7 @@ int ConnectionHandler::handle_connection(int fd, sockaddr *addr, int addrlen,
...
@@ -432,7 +432,7 @@ int ConnectionHandler::handle_connection(int fd, sockaddr *addr, int addrlen,
}
}
WorkerEvent
wev
{};
WorkerEvent
wev
{};
wev
.
type
=
NEW_CONNECTION
;
wev
.
type
=
WorkerEventType
::
NEW_CONNECTION
;
wev
.
client_fd
=
fd
;
wev
.
client_fd
=
fd
;
memcpy
(
&
wev
.
client_addr
,
addr
,
addrlen
);
memcpy
(
&
wev
.
client_addr
,
addr
,
addrlen
);
wev
.
client_addrlen
=
addrlen
;
wev
.
client_addrlen
=
addrlen
;
...
...
src/shrpx_worker.cc
View file @
1daf9ce8
...
@@ -369,9 +369,9 @@ void Worker::process_events() {
...
@@ -369,9 +369,9 @@ void Worker::process_events() {
std
::
lock_guard
<
std
::
mutex
>
g
(
m_
);
std
::
lock_guard
<
std
::
mutex
>
g
(
m_
);
// Process event one at a time. This is important for
// Process event one at a time. This is important for
//
NEW_CONNECTION event since accepting large number of new
//
WorkerEventType::NEW_CONNECTION event since accepting large
//
connections at once may delay time to 1st byte for existing
//
number of new connections at once may delay time to 1st byte
// connections.
//
for existing
connections.
if
(
q_
.
empty
())
{
if
(
q_
.
empty
())
{
ev_timer_stop
(
loop_
,
&
proc_wev_timer_
);
ev_timer_stop
(
loop_
,
&
proc_wev_timer_
);
...
@@ -389,7 +389,7 @@ void Worker::process_events() {
...
@@ -389,7 +389,7 @@ void Worker::process_events() {
auto
worker_connections
=
config
->
conn
.
upstream
.
worker_connections
;
auto
worker_connections
=
config
->
conn
.
upstream
.
worker_connections
;
switch
(
wev
.
type
)
{
switch
(
wev
.
type
)
{
case
NEW_CONNECTION
:
{
case
WorkerEventType
:
:
NEW_CONNECTION
:
{
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
WLOG
(
INFO
,
this
)
<<
"WorkerEvent: client_fd="
<<
wev
.
client_fd
WLOG
(
INFO
,
this
)
<<
"WorkerEvent: client_fd="
<<
wev
.
client_fd
<<
", addrlen="
<<
wev
.
client_addrlen
;
<<
", addrlen="
<<
wev
.
client_addrlen
;
...
@@ -423,14 +423,14 @@ void Worker::process_events() {
...
@@ -423,14 +423,14 @@ void Worker::process_events() {
break
;
break
;
}
}
case
REOPEN_LOG
:
case
WorkerEventType
:
:
REOPEN_LOG
:
WLOG
(
NOTICE
,
this
)
<<
"Reopening log files: worker process (thread "
<<
this
WLOG
(
NOTICE
,
this
)
<<
"Reopening log files: worker process (thread "
<<
this
<<
")"
;
<<
")"
;
reopen_log_files
(
config
->
logging
);
reopen_log_files
(
config
->
logging
);
break
;
break
;
case
GRACEFUL_SHUTDOWN
:
case
WorkerEventType
:
:
GRACEFUL_SHUTDOWN
:
WLOG
(
NOTICE
,
this
)
<<
"Graceful shutdown commencing"
;
WLOG
(
NOTICE
,
this
)
<<
"Graceful shutdown commencing"
;
graceful_shutdown_
=
true
;
graceful_shutdown_
=
true
;
...
@@ -442,7 +442,7 @@ void Worker::process_events() {
...
@@ -442,7 +442,7 @@ void Worker::process_events() {
}
}
break
;
break
;
case
REPLACE_DOWNSTREAM
:
case
WorkerEventType
:
:
REPLACE_DOWNSTREAM
:
WLOG
(
NOTICE
,
this
)
<<
"Replace downstream"
;
WLOG
(
NOTICE
,
this
)
<<
"Replace downstream"
;
replace_downstream_config
(
wev
.
downstreamconf
);
replace_downstream_config
(
wev
.
downstreamconf
);
...
@@ -450,7 +450,7 @@ void Worker::process_events() {
...
@@ -450,7 +450,7 @@ void Worker::process_events() {
break
;
break
;
default:
default:
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
WLOG
(
INFO
,
this
)
<<
"unknown event type "
<<
wev
.
type
;
WLOG
(
INFO
,
this
)
<<
"unknown event type "
<<
static_cast
<
int
>
(
wev
.
type
)
;
}
}
}
}
}
}
...
...
src/shrpx_worker.h
View file @
1daf9ce8
...
@@ -211,7 +211,7 @@ struct WorkerStat {
...
@@ -211,7 +211,7 @@ struct WorkerStat {
size_t
num_connections
;
size_t
num_connections
;
};
};
enum
WorkerEventType
{
enum
class
WorkerEventType
{
NEW_CONNECTION
=
0x01
,
NEW_CONNECTION
=
0x01
,
REOPEN_LOG
=
0x02
,
REOPEN_LOG
=
0x02
,
GRACEFUL_SHUTDOWN
=
0x03
,
GRACEFUL_SHUTDOWN
=
0x03
,
...
...
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