Add specific multi-bind to AsyncServerSocket
authorCameron Pickett <pickett@fb.com>
Tue, 16 Dec 2014 21:02:26 +0000 (13:02 -0800)
committerJoelMarcey <joelm@fb.com>
Thu, 18 Dec 2014 20:29:40 +0000 (12:29 -0800)
commitadc966e14fadb178cd51a5ed668684221bd92ac4
treefcab7490b5668fcb9d2cfa0b604121480fae987d
parent1a608d58e87bb9e0c006918293ec9b7e759b11e2
Add specific multi-bind to AsyncServerSocket

Summary:
Add a bind api similar to binding by port across all interfaces.
However, this bind will only attempt to bind sockets to the supplied
IP addresses. I'd like to add this to aid in moving TURN to IPv6.

TURN will use two specified addresses, one for IPv4, and one for IPv6, to
handle incoming connections from clients. In order to avoid duplicating
workers, we'd like to take advantage of the multi-socket implementation
of AsyncServerSocket. However, we don't want to bind to all interfaces,
especially for port 443.

Test Plan:
Plan to test by adapting TurnTcpListener to use this new API. See that
1. using one address still works as expected,
2. using zero addesses will cause exception
3. using multiple addresses works as expected

Will write unit tests if needed

Reviewed By: davejwatson@fb.com

Subscribers: hannesr, trunkagent, net-systems@, folly-diffs@, naizhi

FB internal diff: D1729442

Tasks: 3633642

Signature: t1:1729442:1418752467:22a60da4ec9009ea0b7fe28a8a436a179e0449aa
folly/io/async/AsyncServerSocket.cpp
folly/io/async/AsyncServerSocket.h