Interesting problem... I hav a few questions :
1) is the client under your control ? Ie, can you make so that the client does not send any message until teh handshake has completed ? 2) In case you can't control the client, what I understand is that you differ the decoding of the received message until the handshake is completed. Am I right ? Le 3/27/14 8:31 PM, Max Larsson a écrit : > > Hi, > > i have a question regarding who to implement it in a nice way. > > Background: > > The protocol i implements has upon a connection establishment a > small handshake. Mainly to choose which version and variant of > the protocol to use. > For the handshake i implemented a StateMachine, which upon a > session create event start the handshake. Thats works fine. > > Now if i use the higher level implementation i have a method > connect which tells mina to use my iohandler etc and try to build > a connection. Next i send some protocol messages. Now i have the > problem that the handshake needs some time and between connect > and sending a message the state machine hasn't yet gone through > the handshake and thus don't forward the message top the socket, > as long it isn't in the matching state. > To avoid that i do the following in the connect method: > > - connect > - wait for sessionCraeted event // now the StateMachine performs the > hadnshake > - i sleep for about 2 seconds > > And for that last step i have a feeling there must be a better way > to implement that? > > > best regards > > > Max Larsson > -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
