diff --git a/Common/Net/Sinks.cpp b/Common/Net/Sinks.cpp index 2d15de15cf..a81d3ce998 100644 --- a/Common/Net/Sinks.cpp +++ b/Common/Net/Sinks.cpp @@ -164,6 +164,12 @@ bool InputSink::Skip(size_t bytes) { return true; } +void InputSink::Discard() { + read_ = 0; + write_ = 0; + valid_ = 0; +} + void InputSink::Fill() { // Avoid small reads if possible. if (BUFFER_SIZE - valid_ > PRESSURE) { diff --git a/Common/Net/Sinks.h b/Common/Net/Sinks.h index fa5546c917..e49630f57f 100644 --- a/Common/Net/Sinks.h +++ b/Common/Net/Sinks.h @@ -19,6 +19,7 @@ public: size_t TakeAtMost(char *buf, size_t bytes); // Skip exactly this number of bytes, or fail. bool Skip(size_t bytes); + void Discard(); bool Empty(); bool TryFill(); diff --git a/Core/Debugger/WebSocket.cpp b/Core/Debugger/WebSocket.cpp index 418c81188d..9c4cdeef3c 100644 --- a/Core/Debugger/WebSocket.cpp +++ b/Core/Debugger/WebSocket.cpp @@ -196,6 +196,7 @@ void HandleDebuggerRequest(const http::Request &request) { } delete ws; + request.In()->Discard(); UpdateConnected(-1); }