Fix static analysis error
This commit is contained in:
parent
c9f3de5f6b
commit
5b55874d4d
|
@ -259,7 +259,7 @@ public:
|
|||
void accept_connection(int fd)
|
||||
{
|
||||
int val = 1;
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void)setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
reinterpret_cast<char *>(&val), sizeof(val));
|
||||
SSL *ssl = nullptr;
|
||||
if(ssl_ctx_) {
|
||||
|
@ -1309,7 +1309,7 @@ int hd_on_frame_send_callback
|
|||
auto promised_stream = hd->get_stream(promised_stream_id);
|
||||
auto stream = hd->get_stream(frame->hd.stream_id);
|
||||
|
||||
if(!promised_stream) {
|
||||
if(!stream || !promised_stream) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1550,7 +1550,9 @@ int start_listen(event_base *evbase, Sessions *sessions, const Config *config)
|
|||
hints.ai_flags |= AI_ADDRCONFIG;
|
||||
#endif // AI_ADDRCONFIG
|
||||
|
||||
auto listen_handler = new ListenEventHandler(sessions, config);
|
||||
auto listen_handler_store =
|
||||
util::make_unique<ListenEventHandler>(sessions, config);
|
||||
auto listen_handler = listen_handler_store.get();
|
||||
|
||||
addrinfo *res, *rp;
|
||||
r = getaddrinfo(nullptr, service, &hints, &res);
|
||||
|
@ -1585,6 +1587,8 @@ int start_listen(event_base *evbase, Sessions *sessions, const Config *config)
|
|||
LEV_OPT_REUSEABLE | LEV_OPT_CLOSE_ON_FREE, -1, fd);
|
||||
evconnlistener_set_error_cb(evlistener, evlistener_errorcb);
|
||||
|
||||
listen_handler_store.release();
|
||||
|
||||
if(config->verbose) {
|
||||
std::cout << (rp->ai_family == AF_INET ? "IPv4" : "IPv6")
|
||||
<< ": listen on port "
|
||||
|
|
|
@ -86,12 +86,13 @@ static void output_to_json(nghttp2_hd_deflater *deflater,
|
|||
auto len = nghttp2_bufs_len(bufs);
|
||||
auto hex = std::vector<char>(len * 2);
|
||||
auto obj = json_object();
|
||||
auto comp_ratio = inputlen == 0 ? 0.0 : (double)len / inputlen * 100;
|
||||
|
||||
json_object_set_new(obj, "seq", json_integer(seq));
|
||||
json_object_set_new(obj, "input_length", json_integer(inputlen));
|
||||
json_object_set_new(obj, "output_length", json_integer(len));
|
||||
json_object_set_new(obj, "percentage_of_original_size",
|
||||
json_real((double)len / inputlen * 100));
|
||||
json_real(comp_ratio));
|
||||
|
||||
auto hexp = hex.data();
|
||||
for(auto ci = bufs->head; ci; ci = ci->next) {
|
||||
|
@ -462,7 +463,10 @@ int main(int argc, char **argv)
|
|||
} else {
|
||||
perform();
|
||||
}
|
||||
|
||||
auto comp_ratio = input_sum == 0 ? 0.0 : (double)output_sum / input_sum;
|
||||
|
||||
fprintf(stderr, "Overall: input=%zu output=%zu ratio=%.02f\n",
|
||||
input_sum, output_sum, (double)output_sum / input_sum);
|
||||
input_sum, output_sum, comp_ratio);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ void eventcb(bufferevent *bev, short events, void *ptr)
|
|||
}
|
||||
int fd = bufferevent_getfd(bev);
|
||||
int val = 1;
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void)setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
||||
reinterpret_cast<char *>(&val), sizeof(val));
|
||||
client->state = CLIENT_CONNECTED;
|
||||
client->on_connect();
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
*/
|
||||
#include "h2load_http2_session.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "h2load.h"
|
||||
#include "util.h"
|
||||
|
||||
|
@ -111,6 +113,8 @@ int on_stream_close_callback
|
|||
|
||||
void Http2Session::on_connect()
|
||||
{
|
||||
int rv;
|
||||
|
||||
nghttp2_session_callbacks callbacks = {0};
|
||||
callbacks.before_frame_send_callback = before_frame_send_callback;
|
||||
callbacks.on_frame_recv_callback = on_frame_recv_callback;
|
||||
|
@ -125,9 +129,12 @@ void Http2Session::on_connect()
|
|||
iv[0].value = 0;
|
||||
iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||
iv[1].value = (1 << client_->worker->config->window_bits) - 1;
|
||||
nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, iv,
|
||||
|
||||
rv = nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, iv,
|
||||
sizeof(iv) / sizeof(iv[0]));
|
||||
|
||||
assert(rv == 0);
|
||||
|
||||
auto extra_connection_window =
|
||||
(1 << client_->worker->config->connection_window_bits) - 1
|
||||
- NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE;
|
||||
|
|
|
@ -818,7 +818,7 @@ int main(int argc, char **argv)
|
|||
|
||||
std::vector<std::pair<const char*, const char*> > cmdcfgs;
|
||||
while(1) {
|
||||
int flag;
|
||||
int flag = 0;
|
||||
static option long_options[] = {
|
||||
{"daemon", no_argument, nullptr, 'D'},
|
||||
{"log-level", required_argument, nullptr, 'L'},
|
||||
|
|
Loading…
Reference in New Issue