X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=client.cpp;h=eea41a5e0da43d40b0c468b206158f69198ac1b6;hp=04518c8c2f58a97e9afcd877b77c91863d319bcc;hb=9bb62cbda887f69e570a3ea0fd28b564c5adc2c9;hpb=5cd46e39b4063d94f6dc559ae350beeb8406a8f9 diff --git a/client.cpp b/client.cpp index 04518c8..eea41a5 100644 --- a/client.cpp +++ b/client.cpp @@ -9,6 +9,10 @@ #include "state.pb.h" #include "stream.h" +#ifndef SO_MAX_PACING_RATE +#define SO_MAX_PACING_RATE 47 +#endif + using namespace std; Client::Client(int sock) @@ -60,7 +64,7 @@ Client::Client(const ClientProto &serialized, Stream *stream) connect_time(serialized.connect_time()), state(State(serialized.state())), request(serialized.request()), - stream_id(serialized.stream_id()), + url(serialized.url()), stream(stream), header_or_error(serialized.header_or_error()), header_or_error_bytes_sent(serialized.header_or_error_bytes_sent()), @@ -80,6 +84,11 @@ Client::Client(const ClientProto &serialized, Stream *stream) } fwmark = 0; } + if (setsockopt(sock, SOL_SOCKET, SO_MAX_PACING_RATE, &stream->pacing_rate, sizeof(stream->pacing_rate)) == -1) { + if (stream->pacing_rate != ~0U) { + log_perror("setsockopt(SO_MAX_PACING_RATE)"); + } + } } ClientProto Client::serialize() const @@ -90,7 +99,7 @@ ClientProto Client::serialize() const serialized.set_connect_time(connect_time); serialized.set_state(state); serialized.set_request(request); - serialized.set_stream_id(stream_id); + serialized.set_url(url); serialized.set_header_or_error(header_or_error); serialized.set_header_or_error_bytes_sent(serialized.header_or_error_bytes_sent()); serialized.set_stream_pos(stream_pos); @@ -103,10 +112,10 @@ ClientProto Client::serialize() const ClientStats Client::get_stats() const { ClientStats stats; - if (stream_id.empty()) { - stats.stream_id = "-"; + if (url.empty()) { + stats.url = "-"; } else { - stats.stream_id = stream_id; + stats.url = url; } stats.sock = sock; stats.fwmark = fwmark;