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
0f759978
Commit
0f759978
authored
Sep 13, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Share ev_token_bucket_cfg across ClientHandlers
parent
cbef6fd0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
src/shrpx.cc
src/shrpx.cc
+4
-0
src/shrpx_client_handler.cc
src/shrpx_client_handler.cc
+1
-6
src/shrpx_client_handler.h
src/shrpx_client_handler.h
+0
-1
src/shrpx_config.h
src/shrpx_config.h
+3
-0
No files found.
src/shrpx.cc
View file @
0f759978
...
@@ -400,6 +400,10 @@ void fill_default_config()
...
@@ -400,6 +400,10 @@ void fill_default_config()
mod_config
()
->
downstream_http_proxy_host
=
0
;
mod_config
()
->
downstream_http_proxy_host
=
0
;
mod_config
()
->
downstream_http_proxy_port
=
0
;
mod_config
()
->
downstream_http_proxy_port
=
0
;
mod_config
()
->
downstream_http_proxy_addrlen
=
0
;
mod_config
()
->
downstream_http_proxy_addrlen
=
0
;
mod_config
()
->
rate_limit_cfg
=
ev_token_bucket_cfg_new
(
1024
*
1024
,
4
*
1024
*
1024
,
EV_RATE_LIMIT_MAX
,
EV_RATE_LIMIT_MAX
,
nullptr
);
}
}
}
// namespace
}
// namespace
...
...
src/shrpx_client_handler.cc
View file @
0f759978
...
@@ -212,10 +212,6 @@ void upstream_http1_connhd_readcb(bufferevent *bev, void *arg)
...
@@ -212,10 +212,6 @@ void upstream_http1_connhd_readcb(bufferevent *bev, void *arg)
ClientHandler
::
ClientHandler
(
bufferevent
*
bev
,
int
fd
,
SSL
*
ssl
,
ClientHandler
::
ClientHandler
(
bufferevent
*
bev
,
int
fd
,
SSL
*
ssl
,
const
char
*
ipaddr
)
const
char
*
ipaddr
)
:
bev_
(
bev
),
:
bev_
(
bev
),
evbucket_cfg_
(
ev_token_bucket_cfg_new
(
1024
*
1024
,
4
*
1024
*
1024
,
EV_RATE_LIMIT_MAX
,
EV_RATE_LIMIT_MAX
,
nullptr
)),
fd_
(
fd
),
fd_
(
fd
),
ssl_
(
ssl
),
ssl_
(
ssl
),
upstream_
(
nullptr
),
upstream_
(
nullptr
),
...
@@ -224,7 +220,7 @@ ClientHandler::ClientHandler(bufferevent *bev, int fd, SSL *ssl,
...
@@ -224,7 +220,7 @@ ClientHandler::ClientHandler(bufferevent *bev, int fd, SSL *ssl,
spdy_
(
nullptr
),
spdy_
(
nullptr
),
left_connhd_len_
(
NGHTTP2_CLIENT_CONNECTION_HEADER_LEN
)
left_connhd_len_
(
NGHTTP2_CLIENT_CONNECTION_HEADER_LEN
)
{
{
bufferevent_set_rate_limit
(
bev_
,
evbucket_cfg_
);
bufferevent_set_rate_limit
(
bev_
,
get_config
()
->
rate_limit_cfg
);
bufferevent_enable
(
bev_
,
EV_READ
|
EV_WRITE
);
bufferevent_enable
(
bev_
,
EV_READ
|
EV_WRITE
);
bufferevent_setwatermark
(
bev_
,
EV_READ
,
0
,
SHRPX_READ_WARTER_MARK
);
bufferevent_setwatermark
(
bev_
,
EV_READ
,
0
,
SHRPX_READ_WARTER_MARK
);
set_upstream_timeouts
(
&
get_config
()
->
upstream_read_timeout
,
set_upstream_timeouts
(
&
get_config
()
->
upstream_read_timeout
,
...
@@ -250,7 +246,6 @@ ClientHandler::~ClientHandler()
...
@@ -250,7 +246,6 @@ ClientHandler::~ClientHandler()
}
}
bufferevent_disable
(
bev_
,
EV_READ
|
EV_WRITE
);
bufferevent_disable
(
bev_
,
EV_READ
|
EV_WRITE
);
bufferevent_free
(
bev_
);
bufferevent_free
(
bev_
);
ev_token_bucket_cfg_free
(
evbucket_cfg_
);
if
(
ssl_
)
{
if
(
ssl_
)
{
SSL_free
(
ssl_
);
SSL_free
(
ssl_
);
}
}
...
...
src/shrpx_client_handler.h
View file @
0f759978
...
@@ -76,7 +76,6 @@ public:
...
@@ -76,7 +76,6 @@ public:
bool
get_http2_upgrade_allowed
()
const
;
bool
get_http2_upgrade_allowed
()
const
;
private:
private:
bufferevent
*
bev_
;
bufferevent
*
bev_
;
ev_token_bucket_cfg
*
evbucket_cfg_
;
int
fd_
;
int
fd_
;
SSL
*
ssl_
;
SSL
*
ssl_
;
Upstream
*
upstream_
;
Upstream
*
upstream_
;
...
...
src/shrpx_config.h
View file @
0f759978
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <vector>
#include <vector>
#include <event.h>
#include <openssl/ssl.h>
#include <openssl/ssl.h>
namespace
shrpx
{
namespace
shrpx
{
...
@@ -167,6 +168,8 @@ struct Config {
...
@@ -167,6 +168,8 @@ struct Config {
sockaddr_union
downstream_http_proxy_addr
;
sockaddr_union
downstream_http_proxy_addr
;
// actual size of downstream_http_proxy_addr
// actual size of downstream_http_proxy_addr
size_t
downstream_http_proxy_addrlen
;
size_t
downstream_http_proxy_addrlen
;
// Rate limit configuration
ev_token_bucket_cfg
*
rate_limit_cfg
;
};
};
const
Config
*
get_config
();
const
Config
*
get_config
();
...
...
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