Skip to content

Instantly share code, notes, and snippets.

@gnufied
Created May 3, 2009 06:36
Show Gist options
  • Save gnufied/105874 to your computer and use it in GitHub Desktop.
Save gnufied/105874 to your computer and use it in GitHub Desktop.
if (sc.connect (new InetSocketAddress (address, port))) {
// Connection returned immediately. Can happen with localhost connections.
// WARNING, this code is untested due to lack of available test conditions.
// Ought to be be able to come here from a localhost connection, but that
// doesn't happen on Linux. (Maybe on FreeBSD?)
// The reason for not handling this until we can test it is that we
// really need to return from this function WITHOUT triggering any EM events.
// That's because until the user code has seen the signature we generated here,
// it won't be able to properly dispatch them. The C++ EM deals with this
// by setting pending mode as a flag in ALL eventable descriptors and making
// the descriptor select for writable. Then, it can send UNBOUND and
// CONNECTION_COMPLETED on the next pass through the loop, because writable will
// fire.
throw new RuntimeException ("immediate-connect unimplemented");
}
else {
Connections.put (b, ec);
ec.setConnectPending();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment