X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=server.h;h=0f93b7f0b034caa1eb88a276f3b2aa40fa78fc83;hp=271732b55e5a848a232c73fd967cefa4fa26448c;hb=f3e2d52ccf79454ee157917f9017263a8f4c50c3;hpb=4971ba0e48d77b075fc972c13ec2978aa93630a1 diff --git a/server.h b/server.h index 271732b..0f93b7f 100644 --- a/server.h +++ b/server.h @@ -21,9 +21,9 @@ struct Client { // The HTTP request, as sent by the client. If we are in READING_REQUEST, // this might not be finished. - std::string client_request; + std::string request; - // What stream we're connecting to; parsed from client_request. + // What stream we're connecting to; parsed from . // Not relevant for READING_REQUEST. std::string stream_id; @@ -57,14 +57,24 @@ public: // Start a new thread that handles clients. void run(); + + // Stop the thread. + void stop(); + void add_client(int sock); void add_stream(const std::string &stream_id); void set_header(const std::string &stream_id, const std::string &header); void add_data(const std::string &stream_id, const char *data, size_t bytes); private: + pthread_t worker_thread; + + // All variables below this line are protected by the mutex. pthread_mutex_t mutex; + // If the thread should stop or not. + bool should_stop; + // Map from stream ID to stream. std::map streams;