]> git.sesse.net Git - cubemap/commitdiff
Store socket and fwmark in the stats file.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Apr 2013 22:39:17 +0000 (00:39 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Apr 2013 22:39:17 +0000 (00:39 +0200)
client.cpp
client.h
stats.cpp

index bb2d26cdcd4abec4516d23ae92142636a33ac341..5871da1ed70fb111a85db1bcf278735f64a6b62e 100644 (file)
@@ -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;
index db1fea51c69ae090f8a1d70db7b75aaf6f31f62d..d511698550f2d4d5af9234f2eb0671600a72da4e 100644 (file)
--- 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;
index 71fb4852cef695693c1a91e70ef4a61c2f764cb1..fa483bf3a617fbed566ac1d053ac21e6e115c858 100644 (file)
--- 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),