]> git.sesse.net Git - cubemap/commitdiff
Merge branch 'master' of /srv/git.sesse.net/www/cubemap
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Apr 2013 22:39:36 +0000 (00:39 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Apr 2013 22:39:36 +0000 (00:39 +0200)
client.cpp
client.h
server.cpp
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 46bda5b21935ff36d0aca3be838885c5e4b7b7ba..3d915c22c99ad2c94e5aac6878e92f76b233afb2 100644 (file)
@@ -268,7 +268,7 @@ read_request_again:
        
                switch (status) {
                case RP_OUT_OF_SPACE:
-                       log(WARNING, "fd %d sent overlong request!", client->sock);
+                       log(WARNING, "[%s] Client sent overlong request!", client->remote_addr.c_str());
                        close_client(client);
                        return;
                case RP_NOT_FINISHED_YET:
@@ -276,7 +276,7 @@ read_request_again:
                        // See if there's more data for us.
                        goto read_request_again;
                case RP_EXTRA_DATA:
-                       log(WARNING, "fd %d had junk data after request!", client->sock);
+                       log(WARNING, "[%s] Junk data after request!", client->remote_addr.c_str());
                        close_client(client);
                        return;
                case RP_FINISHED:
@@ -357,8 +357,8 @@ sending_data_again:
                        return;
                }
                if (bytes_to_send > stream->backlog_size) {
-                       log(WARNING, "fd %d lost %lld bytes, maybe too slow connection",
-                               client->sock,
+                       log(WARNING, "[%s] Client lost %lld bytes, maybe too slow connection",
+                               client->remote_addr.c_str(),
                                (long long int)(bytes_to_send - stream->backlog_size));
                        client->stream_pos = stream->bytes_received - stream->backlog_size;
                        client->bytes_lost += bytes_to_send - stream->backlog_size;
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),