- // Add more input data to the stream, and wake up all clients that are sleeping.
- void add_data(const char *data, ssize_t bytes);
+ // Add more data to <queued_data>, adding Metacube headers if needed.
+ // Does not take ownership of <data>.
+ // You should hold the owning Server's <queued_data_mutex>.
+ void add_data_deferred(const char *data, size_t bytes);
+
+ // Add queued data to the stream, if any.
+ // You should hold the owning Server's <mutex> _and_ <queued_data_mutex>.
+ void process_queued_data();