Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/WebSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,25 @@ struct WebSocket : AsyncSocket<SSL> {
(us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
);

/* Skip sending and report success if we are over the limit of maxBackpressure */
if (webSocketContextData->maxBackpressure && webSocketContextData->maxBackpressure < getBufferedAmount()) {
/* Also defer a close if we should */
if (webSocketContextData->closeOnBackpressureLimit) {
us_socket_shutdown_read(SSL, (us_socket_t *) this);
}
//only drop text and binary message when pressure, control message such as ping pong and close message should not be drop
if (opCode == OpCode::TEXT || opCode == OpCode::BINARY) {
/* Skip sending and report success if we are over the limit of maxBackpressure */
if (webSocketContextData->maxBackpressure && webSocketContextData->maxBackpressure < getBufferedAmount()) {
/* Also defer a close if we should */
if (webSocketContextData->closeOnBackpressureLimit) {
us_socket_shutdown_read(SSL, (us_socket_t *) this);
}

/* It is okay to call send again from within this callback since we immediately return with DROPPED afterwards */
if (webSocketContextData->droppedHandler) {
webSocketContextData->droppedHandler(this, message, opCode);
}
/* It is okay to call send again from within this callback since we immediately return with DROPPED afterwards */
if (webSocketContextData->droppedHandler) {
webSocketContextData->droppedHandler(this, message, opCode);
}

return DROPPED;
return DROPPED;
}
}


/* If we are subscribers and have messages to drain we need to drain them here to stay synced */
WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();

Expand Down
Loading