mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 05:49:58 +00:00
http: Discard output buffer on disconnect.
Prevents an assert.
This commit is contained in:
parent
c7baed26db
commit
b7ac9a6f37
@ -341,6 +341,12 @@ bool OutputSink::Flush(bool allowBlock) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void OutputSink::Discard() {
|
||||
read_ = 0;
|
||||
write_ = 0;
|
||||
valid_ = 0;
|
||||
}
|
||||
|
||||
void OutputSink::Drain() {
|
||||
// Avoid small reads if possible.
|
||||
if (valid_ > PRESSURE) {
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
bool Printf(const char *fmt, ...);
|
||||
|
||||
bool Flush(bool allowBlock = true);
|
||||
void Discard();
|
||||
|
||||
bool Empty();
|
||||
|
||||
|
@ -259,6 +259,8 @@ bool WebSocketServer::Process(float timeout) {
|
||||
// Since select said it was readable, we assume this means disconnect.
|
||||
closeReason_ = WebSocketClose::ABNORMAL;
|
||||
open_ = false;
|
||||
// Kill any remaining output too.
|
||||
out_->Discard();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user