File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,11 +94,17 @@ struct WebSocket : AsyncSocket<SSL> {
9494 (us_socket_context_t *) us_socket_context (SSL, (us_socket_t *) this )
9595 );
9696
97+ /* If we already reached the max backpressure and started a deferred close, reject all sends */
98+ if (webSocketContextData->closeOnBackpressureLimit == 2 ) {
99+ return DROPPED;
100+ }
101+
97102 /* Skip sending and report success if we are over the limit of maxBackpressure */
98103 if (webSocketContextData->maxBackpressure && webSocketContextData->maxBackpressure < getBufferedAmount ()) {
99104 /* Also defer a close if we should */
100- if (webSocketContextData->closeOnBackpressureLimit ) {
105+ if (webSocketContextData->closeOnBackpressureLimit == 1 ) {
101106 us_socket_shutdown_read (SSL, (us_socket_t *) this );
107+ webSocketContextData->closeOnBackpressureLimit = 2 ;
102108 }
103109 return DROPPED;
104110 }
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ struct WebSocketContextData {
7373
7474 /* There needs to be a maxBackpressure which will force close everything over that limit */
7575 size_t maxBackpressure = 0 ;
76- bool closeOnBackpressureLimit;
76+ unsigned char closeOnBackpressureLimit; /* 0, 1 (or 2 internally) */
7777 bool resetIdleTimeoutOnSend;
7878 bool sendPingsAutomatically;
7979
You can’t perform that action at this time.
0 commit comments