Connection failover doesn't work with non-blocking connect
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cyphesis |
Invalid
|
Undecided
|
Erik Ogenvik |
Bug Description
skstream supports two features when making outgoing connections.
1) Non blocking connect
2) Trying each address in turn when getaddrinfo returns multiple results.
skstream supports the two together by implementing stepping over the address list in the isReady() method. This does not interact well with cyphesis socket infrastructure. The poll loop has to detect when the connection fails, and in this case HUP is returned by epoll, causing the socket to be removed and deleted.
To work cyphesis will have to inform the socket object that it got HUP, so it can call isReady() iterating to the next address. Cyphesis will also need to allow the socket to add the new fd, as the old one is implicitly replaced.
It may be easier to solve this problem if we don't initially ask for HUP events on connecting sockets, just read().