Actually, a key will not exist when I register a connection with Selector - but the local port can be a a connection ID.
On Tue, Apr 14, 2015 at 4:18 PM, Gwen Shapira <gshap...@cloudera.com> wrote: > Hi, > > A lot of the client network code has the assumption that I know where > I'm connecting to - specifically that a connection always has a > specific broker ID. > Sends have "dest", Recieves have "source" and Selector has an id for > connections which is often referred to as source or dest... > > Server code has few cases where we don't actually know the source or > dest, when accepting a connection or when channelToAnyBroker is used. > > My first instinct is that the source / dest is just not that useful in > the server context. I use UNKNOWN_DEST (-1) in the Sends and Receives. > And I'm planning to use key.hashcode as the ID for a connection (in > the selector). > > Am I missing an important insight here about how the client network > code should be used? > > Gwen > > P.S > The receive / send code is already up there. Not very clean, but if > someone can take a quick look and say "yeah, thats the right > direction" or "you moron, you missed A, B and C!", I'll appreciate.