Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Jul 19, 2024
1 parent 636e712 commit 8393010
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
* 1. All sockets are created in non-blocking state. All implementations should cope with non-blocking, i.e. wait/retry.
* 2. read/readtms will block until min_size bytes are read or timeout expires (see readtms for more detail).
* read/readtms can be called with min_size=0, in which case it will return as soon as no more data is available.
* 3. write will block until all bytes are written (could introduce a write min_size/max_size version if needed)
* 3. Historically, SSL calls + non-SSL write/writetms, used to flip blocking state during the call, this was prone to error,
* because socket could [legitimately] be written to whilst being read from, e.g. a server could be writing to a client, and
* at the same time, be notified of traffic and start reading it. Flipping the blocking state of a socket is inherently unsafe
* in many usage patterns.
*
* The non-blocking semantics are designed so that the select handlers can read as much data as possible without blocking.
* e.g. dafilesrv and MP avoid blocking in their select handlers, thus avoiding up other client traffic.
Expand Down

0 comments on commit 8393010

Please sign in to comment.