#include "client.h"
#include "log.h"
-#include "markpool.h"
#include "state.pb.h"
#include "stream.h"
Client::Client(int sock)
: sock(sock),
- fwmark(0),
connect_time(time(NULL)),
state(Client::READING_REQUEST),
stream(NULL),
bytes_lost(serialized.bytes_lost()),
num_loss_events(serialized.num_loss_events())
{
- if (stream != NULL && stream->mark_pool != NULL) {
- fwmark = stream->mark_pool->get_mark();
- } else {
- fwmark = 0; // No mark.
- }
- if (setsockopt(sock, SOL_SOCKET, SO_MARK, &fwmark, sizeof(fwmark)) == -1) {
- if (fwmark != 0) {
- log_perror("setsockopt(SO_MARK)");
- }
- fwmark = 0;
- }
if (stream != NULL) {
if (setsockopt(sock, SOL_SOCKET, SO_MAX_PACING_RATE, &stream->pacing_rate, sizeof(stream->pacing_rate)) == -1) {
if (stream->pacing_rate != ~0U) {
stats.url = url;
}
stats.sock = sock;
- stats.fwmark = fwmark;
stats.remote_addr = remote_addr;
stats.connect_time = connect_time;
stats.bytes_sent = bytes_sent;