X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=httpinput.cpp;h=9d39774b70a18188fba21020421261ab56faafc5;hp=012f5bc0c4f15d2a4da0f425034a7c82a50ff763;hb=3fdf2e48bca3edcb0de00e0dbd0d0aae81ba9aa9;hpb=742f56c25bdd54dc438b21cb5e422de520bc7231 diff --git a/httpinput.cpp b/httpinput.cpp index 012f5bc..9d39774 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,18 @@ HTTPInput::HTTPInput(const InputProto &serialized) parse_url(url, &protocol, &host, &port, &path); // Don't care if it fails. } +void HTTPInput::close_socket() +{ + int ret; + do { + ret = close(sock); + } while (ret == -1 && errno == EINTR); + + if (ret == -1) { + perror("close()"); + } +} + InputProto HTTPInput::serialize() const { InputProto serialized; @@ -215,6 +228,7 @@ void HTTPInput::do_work() request.clear(); request_bytes_sent = 0; response.clear(); + pending_data.clear(); { string protocol; // Thrown away.