From: Steinar H. Gunderson Date: Mon, 15 Apr 2013 22:39:17 +0000 (+0200) Subject: Store socket and fwmark in the stats file. X-Git-Tag: 1.0.0~103^2 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=889d72b31a646feeba52acd3fd2616210b550e71 Store socket and fwmark in the stats file. --- diff --git a/client.cpp b/client.cpp index bb2d26c..5871da1 100644 --- a/client.cpp +++ b/client.cpp @@ -67,6 +67,7 @@ Client::Client(const ClientProto &serialized, Stream *stream) if (fwmark != 0) { log_perror("setsockopt(SO_MARK)"); } + fwmark = 0; } } @@ -92,6 +93,8 @@ ClientStats Client::get_stats() const { ClientStats stats; stats.stream_id = stream_id; + stats.sock = sock; + stats.fwmark = fwmark; stats.remote_addr = remote_addr; stats.connect_time = connect_time; stats.bytes_sent = bytes_sent; diff --git a/client.h b/client.h index db1fea5..d511698 100644 --- a/client.h +++ b/client.h @@ -13,6 +13,8 @@ struct Stream; // Digested statistics for writing to logs etc. struct ClientStats { std::string stream_id; + int sock; + int fwmark; std::string remote_addr; time_t connect_time; size_t bytes_sent; diff --git a/stats.cpp b/stats.cpp index 71fb485..fa483bf 100644 --- a/stats.cpp +++ b/stats.cpp @@ -53,8 +53,10 @@ void StatsThread::do_work() now = time(NULL); client_stats = servers->get_client_stats(); for (size_t i = 0; i < client_stats.size(); ++i) { - fprintf(fp, "%s %s %d %llu %llu %llu\n", + fprintf(fp, "%s %d %d %s %d %llu %llu %llu\n", client_stats[i].remote_addr.c_str(), + client_stats[i].sock, + client_stats[i].fwmark, client_stats[i].stream_id.c_str(), int(now - client_stats[i].connect_time), (long long unsigned)(client_stats[i].bytes_sent),