Skip to content

Commit

Permalink
Add num of connection and change param file to path
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackarain committed Nov 15, 2023
1 parent 38a2059 commit c16a125
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions httpd/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,10 @@ inline awaitable_void file_session(
inline awaitable_void session(tcp_stream stream)
{
static int64_t static_connection_id = 0;
static size_t num_connections = 0;

int64_t connection_id = static_connection_id++;
num_connections++;

boost::system::error_code ec;

Expand Down Expand Up @@ -915,7 +918,13 @@ inline awaitable_void session(tcp_stream stream)

scoped_exit se_quit([&]()
{
LOG_DBG << "Session: " << connection_id << ", left...";
num_connections--;

LOG_DBG << "Session: "
<< connection_id
<< ", left, num connection: "
<< num_connections
<< "...";
});

flat_buffer buffer;
Expand Down Expand Up @@ -1131,7 +1140,7 @@ int main(int argc, char** argv)
desc.add_options()
("help,h", "Help message.")
("listen", po::value<std::string>(&httpd_listen)->default_value("[::0]:80")->value_name("ip:port"), "Httpd tcp listen.")
("file", po::value<std::string>(&httpd_doc)->value_name("file/dir/pipe"), "Filename or directory or pipe.")
("path", po::value<std::string>(&httpd_doc)->value_name("file/dir/pipe"), "Filename or directory or pipe.")
;

po::variables_map vm;
Expand Down

0 comments on commit c16a125

Please sign in to comment.