]> git.sesse.net Git - cubemap/blobdiff - server.cpp
Make the SENDING_HEADER state fall through.
[cubemap] / server.cpp
index 8a8e867be1bf64f3cf47fc3a2c14e2dca37b9b4b..14162f58e5a960cc37e35cb18796e270c883714e 100644 (file)
@@ -473,19 +473,18 @@ sending_header_or_error_again:
                // words, we won't send any of the backlog, but we'll start
                // sending immediately as we get the next keyframe block.
                // This is postcondition #3.
+               Stream *stream = client->stream;
                if (client->stream_pos == size_t(-2)) {
                        client->stream_pos = std::min<size_t>(
-                           client->stream->bytes_received - client->stream->backlog_size,
+                           stream->bytes_received - stream->backlog_size,
                            0);
                        client->state = Client::SENDING_DATA;
+                       goto sending_data;
                } else {
-                       // client->stream_pos should be -1, but it might not be,
-                       // if we have clients from an older version.
-                       client->stream_pos = client->stream->bytes_received;
+                       client->stream_pos = stream->bytes_received;
                        client->state = Client::WAITING_FOR_KEYFRAME;
                }
-               client->stream->put_client_to_sleep(client);
-               return;
+               // Fall through.
        }
        case Client::WAITING_FOR_KEYFRAME: {
                Stream *stream = client->stream;
@@ -515,6 +514,7 @@ sending_header_or_error_again:
                // Fall through.
        }
        case Client::SENDING_DATA: {
+sending_data:
                skip_lost_data(client);
                Stream *stream = client->stream;