Commit Graph
3 Commits
Author SHA1 Message Date
mlsad3 fd820380a6 Fix head-of-line blocking and resource leak in BidirectionalRelay (#713)
- Closes #712.
- Replace synchronous `write()` calls in
  `BidirectionalRelay` with non-blocking I/O
  and `DispatchSourceWrite` backpressure
  handling. Under concurrent vsock proxy load,
  a single blocked write on the shared serial
  dispatch queue would freeze all relay
  connections permanently, including unrelated
  new connections.
- Set relay file descriptors to `O_NONBLOCK`
  and handle `EAGAIN` by suspending reads and
  installing a write source to drain pending data.
- Give each `BidirectionalRelay` its own serial queue
  instead of sharing one from `UnixSocketRelayManager`,
  eliminating cross-connection blocking.
- Resume suspended read sources before cancelling
  in `stop()` — GCD does not deliver cancel handlers
  on suspended dispatch sources, which caused file
  descriptor and memory leaks on teardown under
  backpressure.
- Guard-unwrap `buf.baseAddress` in
  `drainPendingWrite`.
2026-06-01 10:33:36 -07:00
Dmitry Kovba 36002eed5e Fix the socket relay error handling and log level (#535)
- Downgrades a warning to the debug level in `BidirectionalRelay`
because the shutdown syscall isn't supported for certain socket types
- Rethrows an error if we can't start a socket relay
2026-02-18 15:55:50 -08:00
Dmitry Kovba 7c7ed05e10 Add a public method to wait for the relay to complete (#529)
- Adds a public method to wait for the relay to complete when both
directions close
- Improves error handling
- Moves `UnixSocketRelayManager` into a separate file
- Renames `SocketRelay` to `UnixSocketRelay`
- Adds logs at the info level after converting other logs to the debug
level previously
2026-02-11 23:44:22 -08:00