Fake succeed all writes on closed socket (fix memory leak)
This commit is contained in:
@@ -101,6 +101,12 @@ protected:
|
|||||||
* Returns pair of bytes written (anywhere) and wheter or not this call resulted in the polling for
|
* Returns pair of bytes written (anywhere) and wheter or not this call resulted in the polling for
|
||||||
* writable (or we are in a state that implies polling for writable). */
|
* writable (or we are in a state that implies polling for writable). */
|
||||||
std::pair<int, bool> write(const char *src, int length, bool optionally = false, int nextLength = 0) {
|
std::pair<int, bool> write(const char *src, int length, bool optionally = false, int nextLength = 0) {
|
||||||
|
/* Fake success if closed, simpel fix to allow uncork of closed socket to succeed */
|
||||||
|
if (us_socket_is_closed((us_socket *) this)) {
|
||||||
|
std::cout << "Faking successful send due to closed socket!" << std::endl;
|
||||||
|
return {length, false};
|
||||||
|
}
|
||||||
|
|
||||||
LoopData *loopData = getLoopData();
|
LoopData *loopData = getLoopData();
|
||||||
AsyncSocketData<SSL> *asyncSocketData = (AsyncSocketData<SSL> *) getExt();
|
AsyncSocketData<SSL> *asyncSocketData = (AsyncSocketData<SSL> *) getExt();
|
||||||
|
|
||||||
|
|||||||
@@ -263,6 +263,11 @@ private:
|
|||||||
// todo: check for failures here just like for HTTP
|
// todo: check for failures here just like for HTTP
|
||||||
webSocket->uncork();
|
webSocket->uncork();
|
||||||
|
|
||||||
|
// cannot do anything else if closed
|
||||||
|
if (us_socket_is_closed((us_socket *) s)) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
// I guess we need to check drain here - emit drain if we had to poll for writable
|
// I guess we need to check drain here - emit drain if we had to poll for writable
|
||||||
|
|
||||||
// are we shutdown? can onnly call this if we did succeed uncork!
|
// are we shutdown? can onnly call this if we did succeed uncork!
|
||||||
|
|||||||
Reference in New Issue
Block a user