From: Steinar H. Gunderson Date: Mon, 15 Apr 2013 22:39:36 +0000 (+0200) Subject: Merge branch 'master' of /srv/git.sesse.net/www/cubemap X-Git-Tag: 1.0.0~103 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6942bd4c7da1379565817ae82e6ace259abf4492;hp=8cc780cf37063ce29f13380976a54dd8302fe3a9;p=cubemap Merge branch 'master' of /srv/git.sesse.net/www/cubemap --- 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/server.cpp b/server.cpp index 46bda5b..3d915c2 100644 --- a/server.cpp +++ b/server.cpp @@ -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; 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),