diff options
Diffstat (limited to 'packages/bun-uws/src/AsyncSocket.h')
-rw-r--r-- | packages/bun-uws/src/AsyncSocket.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/bun-uws/src/AsyncSocket.h b/packages/bun-uws/src/AsyncSocket.h index 8e3301f24..1051271a2 100644 --- a/packages/bun-uws/src/AsyncSocket.h +++ b/packages/bun-uws/src/AsyncSocket.h @@ -121,18 +121,25 @@ public: void corkUnchecked() { /* What if another socket is corked? */ getLoopData()->corkedSocket = this; + getLoopData()->corkedSocketIsSSL = SSL; } /* Cork this socket. Only one socket may ever be corked per-loop at any given time */ void cork() { /* Extra check for invalid corking of others */ if (getLoopData()->corkOffset && getLoopData()->corkedSocket != this) { - std::cerr << "Error: Cork buffer must not be acquired without checking canCork!" << std::endl; - std::terminate(); + // We uncork the other socket early instead of terminating the program + // is unlikely to be cause any issues and is better than crashing + if(getLoopData()->corkedSocketIsSSL) { + ((AsyncSocket<true> *) getLoopData()->corkedSocket)->uncork(); + } else { + ((AsyncSocket<false> *) getLoopData()->corkedSocket)->uncork(); + } } /* What if another socket is corked? */ getLoopData()->corkedSocket = this; + getLoopData()->corkedSocketIsSSL = SSL; } /* Returns the corked socket or nullptr */ |