aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/webcore/WebSocket.h
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-07-03 20:53:41 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-03 20:53:41 -0700
commit3345a7fc3c81f914000fd5a3c5a24f920a70386a (patch)
treeb4a0d9ffa9d37d17bbf41f74c9d3f3a624ae8aab /src/bun.js/bindings/webcore/WebSocket.h
parentb26b0d886ce2f9898833e8efa16b71952c39b615 (diff)
downloadbun-3345a7fc3c81f914000fd5a3c5a24f920a70386a.tar.gz
bun-3345a7fc3c81f914000fd5a3c5a24f920a70386a.tar.zst
bun-3345a7fc3c81f914000fd5a3c5a24f920a70386a.zip
Allow zero length WebSocket client & server messages (#3488)
* Allow zero length WebSocket client & server messages * Add test * Clean this up a little * Clean up these tests a little * Hopefully fix the test failure in release build * Don't copy into the receive buffer * Less flaky --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/webcore/WebSocket.h')
-rw-r--r--src/bun.js/bindings/webcore/WebSocket.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/bun.js/bindings/webcore/WebSocket.h b/src/bun.js/bindings/webcore/WebSocket.h
index 42261cfc4..846bd186b 100644
--- a/src/bun.js/bindings/webcore/WebSocket.h
+++ b/src/bun.js/bindings/webcore/WebSocket.h
@@ -111,6 +111,20 @@ public:
return m_hasPendingActivity.load();
}
+ void incPendingActivityCount()
+ {
+ m_pendingActivityCount++;
+ ref();
+ updateHasPendingActivity();
+ }
+
+ void decPendingActivityCount()
+ {
+ m_pendingActivityCount--;
+ deref();
+ updateHasPendingActivity();
+ }
+
private:
typedef union AnyWebSocket {
WebSocketClient* client;
@@ -147,20 +161,6 @@ private:
void sendWebSocketString(const String& message);
void sendWebSocketData(const char* data, size_t length);
- void incPendingActivityCount()
- {
- m_pendingActivityCount++;
- ref();
- updateHasPendingActivity();
- }
-
- void decPendingActivityCount()
- {
- m_pendingActivityCount--;
- deref();
- updateHasPendingActivity();
- }
-
void failAsynchronously();
enum class BinaryType { Blob,