From: Steinar H. Gunderson Date: Thu, 23 Jul 2015 16:23:48 +0000 (+0200) Subject: Make the SENDING_HEADER state fall through. X-Git-Tag: 1.2.0~5 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=235107473ceef239747e9995365489899aa90cca;ds=sidebyside Make the SENDING_HEADER state fall through. In the case where we really are in WAITING_KEYFRAME, we will go to sleep immediately in the state below, but there's also a case where we could end up directly in SENDING_DATA and don't want to wait for the stream to get more data to start sending. --- diff --git a/server.cpp b/server.cpp index d811818..14162f5 100644 --- a/server.cpp +++ b/server.cpp @@ -479,12 +479,12 @@ sending_header_or_error_again: stream->bytes_received - stream->backlog_size, 0); client->state = Client::SENDING_DATA; + goto sending_data; } else { client->stream_pos = stream->bytes_received; client->state = Client::WAITING_FOR_KEYFRAME; } - stream->put_client_to_sleep(client); - return; + // Fall through. } case Client::WAITING_FOR_KEYFRAME: { Stream *stream = client->stream; @@ -514,6 +514,7 @@ sending_header_or_error_again: // Fall through. } case Client::SENDING_DATA: { +sending_data: skip_lost_data(client); Stream *stream = client->stream;