Add start/end time options to log_web_proxy
This makes it so that if you only want to plot a portion of a very long
logfile you can do so.
Change-Id: I7b4841d63b5533dd42a6e21c452d78f44efc247d
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/aos/network/web_proxy.h b/aos/network/web_proxy.h
index baca26e..0c1d1dc 100644
--- a/aos/network/web_proxy.h
+++ b/aos/network/web_proxy.h
@@ -41,6 +41,10 @@
void onData(::seasocks::WebSocket *sock, const uint8_t *data,
size_t size) override;
void onDisconnect(::seasocks::WebSocket *sock) override;
+ // Stops recording data, even if the event loop continues running. This allows
+ // us to continue serving the webserver + websocket server, without having to
+ // load more actual data.
+ void StopRecording() { recording_ = false; }
private:
::seasocks::Server *server_;
@@ -51,6 +55,8 @@
connections_;
EventLoop *const event_loop_;
+ // Whether to pay attention to new messages.
+ bool recording_ = true;
};
// Wrapper class that manages the seasocks server and WebsocketHandler.
@@ -75,6 +81,9 @@
void SetDataPath(const char *path) { server_.setStaticPath(path); }
+ // Stops recording data. Useful for setting end times in log replay.
+ void StopRecording();
+
private:
WebProxy(aos::EventLoop *event_loop, aos::internal::EPoll *epoll,
StoreHistory store_history, int per_channel_buffer_size_bytes);
@@ -121,7 +130,12 @@
store_history_(store_history == StoreHistory::kYes),
buffer_size_(buffer_size) {}
- void RunIteration();
+ // Runs a single iteration of going through and fetching new data as needed
+ // and servicing any WebRTC channels that are requesting messages.
+ // fetch_new specifies whether we should actually attempt to retrieve new data
+ // on the channel--if false, will only worry about sending existing data to
+ // any clients.
+ void RunIteration(bool fetch_new);
void AddListener(std::shared_ptr<ScopedDataChannel> data_channel,
TransferMethod transfer_method);