X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=client.cpp;h=5d5c179be0e6df019930fb2924cf22be2e7bcab1;hp=2552c6951067b4c99ebc192ad24ccb6a08fd9260;hb=7c23f706733b12405c0cb8793866b57ba5800c98;hpb=2b9ff2cf5d26abde03f8f2ebea0a423145d0c2d7 diff --git a/client.cpp b/client.cpp index 2552c69..5d5c179 100644 --- a/client.cpp +++ b/client.cpp @@ -1,8 +1,10 @@ #include #include +#include #include #include #include +#include #include "client.h" #include "log.h" @@ -68,6 +70,10 @@ Client::Client(const ClientProto &serialized, const vectorpacing_rate, sizeof(stream->pacing_rate)) == -1) { if (stream->pacing_rate != ~0U) { @@ -115,6 +121,10 @@ Client::Client(const ClientProto &serialized, const vector *short_response_pool) const { + // Unset the close-on-exec flag for the socket. + // (This can't leak into a child, since there's only one thread left.) + fcntl(sock, F_SETFD, 0); + ClientProto serialized; serialized.set_sock(sock); serialized.set_remote_addr(remote_addr); @@ -134,7 +144,7 @@ ClientProto Client::serialize(unordered_map *short_respo serialized.set_header_or_short_response_index(iterator_and_inserted.first->second); } - serialized.set_header_or_short_response_bytes_sent(serialized.header_or_short_response_bytes_sent()); + serialized.set_header_or_short_response_bytes_sent(header_or_short_response_bytes_sent); serialized.set_stream_pos(stream_pos); serialized.set_stream_pos_end(stream_pos_end); serialized.set_bytes_sent(bytes_sent);