X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=server.cpp;h=02efdbbdb6c165612f2ac45219072bbfbd414982;hp=789d8eabd14c88c67524b632b7dbe1debbe410fd;hb=3ce04a3c410c5836394417b19e70f2a95bc8a5e7;hpb=a1906d9fe3e565bbd874df72e8552fa7daf9fb9a diff --git a/server.cpp b/server.cpp index 789d8ea..02efdbb 100644 --- a/server.cpp +++ b/server.cpp @@ -14,6 +14,7 @@ #include #include +#include "log.h" #include "markpool.h" #include "mutexlock.h" #include "parse.h" @@ -267,7 +268,7 @@ read_request_again: switch (status) { case RP_OUT_OF_SPACE: - fprintf(stderr, "WARNING: fd %d sent overlong request!\n", client->sock); + log(WARNING, "fd %d sent overlong request!", client->sock); close_client(client); return; case RP_NOT_FINISHED_YET: @@ -275,7 +276,7 @@ read_request_again: // See if there's more data for us. goto read_request_again; case RP_EXTRA_DATA: - fprintf(stderr, "WARNING: fd %d had junk data after request!\n", client->sock); + log(WARNING, "fd %d had junk data after request!", client->sock); close_client(client); return; case RP_FINISHED: @@ -356,7 +357,7 @@ sending_data_again: return; } if (bytes_to_send > stream->backlog_size) { - fprintf(stderr, "WARNING: fd %d lost %lld bytes, maybe too slow connection\n", + log(WARNING, "fd %d lost %lld bytes, maybe too slow connection", client->sock, (long long int)(bytes_to_send - stream->backlog_size)); client->stream_pos = stream->bytes_received - stream->backlog_size; @@ -397,7 +398,7 @@ sending_data_again: // We don't have any more data for this client, so put it to sleep. // This is postcondition #3. stream->put_client_to_sleep(client); - } else if (more_data && ret == bytes_to_send) { + } else if (more_data && size_t(ret) == bytes_to_send) { goto sending_data_again; } break;