Skip to content

Commit

Permalink
Fix spin-loop in websocket write when socket buffer is full
Browse files Browse the repository at this point in the history
If the socket buffer is (almost) full and can hold some of the websocket
frame we made, a return value of 0 bytes written would make it try
forever (calling the write() syscall), until either the socket buffer
was drained, or until it errored out with ETIMEDOUT.
  • Loading branch information
halfgaar committed May 26, 2024
1 parent 023c030 commit 4281d28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion iowrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ ssize_t IoWrapper::writeWebsocketAndOrSsl(int fd, const void *buf, size_t nbytes

if (n > 0)
websocketWriteRemainder.advanceTail(n);
if (n < 0)
else
break;
}

Expand Down

0 comments on commit 4281d28

Please sign in to comment.