]> git.sesse.net Git - cubemap/blobdiff - server.h
Fix so clients would actually be woken up from the worker thread, not the input threa...
[cubemap] / server.h
index 24e2fcbac3a737a91211bed9eea590d9d1c1a86a..6e0dd9dac2fd98f48d2a7fc24def92b5eee064cd 100644 (file)
--- a/server.h
+++ b/server.h
@@ -15,6 +15,7 @@
 
 class ClientProto;
 class CubemapStateProto;
+class Stream;
 class StreamProto;
 
 struct Client {
@@ -22,7 +23,7 @@ struct Client {
        Client(int sock);
 
        // Serialization/deserialization.
-       Client(const ClientProto &serialized);
+       Client(const ClientProto &serialized, Stream *stream);
        ClientProto serialize() const;
 
        // The file descriptor associated with this socket.
@@ -38,6 +39,7 @@ struct Client {
        // What stream we're connecting to; parsed from <request>.
        // Not relevant for READING_REQUEST.
        std::string stream_id;
+       Stream *stream;
 
        // The header we want to send. This is nominally a copy of Stream::header,
        // but since that might change on reconnects etc., we keep a local copy here.
@@ -122,6 +124,10 @@ private:
        // See put_client_to_sleep() and wake_up_all_clients().
        std::vector<Client *> sleeping_clients;
 
+       // Clients that we recently got data for (when they were in
+       // <sleeping_clients>).
+       std::vector<Client *> to_process;
+
        // Recover the this pointer, and call do_work().
        static void *do_work_thunk(void *arg);