Skip to content

transport: pool a WSS connection under the remote address - #332

Open
Mliviu79 wants to merge 1 commit into
emiago:mainfrom
Mliviu79:pr/wss-pool-keying
Open

transport: pool a WSS connection under the remote address#332
Mliviu79 wants to merge 1 commit into
emiago:mainfrom
Mliviu79:pr/wss-pool-keying

Conversation

@Mliviu79

Copy link
Copy Markdown
Contributor

Fixes #331

TransportWSS.CreateConnection passed (laddr, raddr) to the pool while UDP, TCP, TLS and WS all pass (raddr, laddr). The pool keys on its first argument, so the socket was registered under our own local address — twice, since the pool also keys c.LocalAddr() — and under the far end address never.

serverRequestConnection looks a connection up by req.Source() for an inbound request, so it missed one that was open and healthy. A WebSocket client is not reachable at its contact address, so that socket is the only path back to it and the request was undeliverable.

One line of source. The test drives CreateConnection against a real TLS WebSocket server on loopback with certificate verification left on, and fails on the old order — the existing pool unit tests all pass the arguments in by hand, so none of them can catch a caller composing correct pieces in the wrong order.

TransportWSS.CreateConnection passed (laddr, raddr) to the pool while UDP, TCP,
TLS and WS all pass (raddr, laddr). The pool keys on its first argument, so the
socket was registered under our own local address -- twice, since the pool also
keys c.LocalAddr() -- and under the far end address never.

serverRequestConnection looks a connection up by req.Source() for an inbound
request, so it missed one that was open and healthy. A WebSocket client is not
reachable at its contact address, so that socket is the only path back to it and
the request was undeliverable.

The test drives CreateConnection against a TLS WebSocket server on loopback and
fails on the old order.

Refs emiago#331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sip: WSS pools the connection under the local address, not the remote

1 participant