On 09/12/2014 23:42, Rémy Maucherat wrote:
> 2014-12-09 20:47 GMT+01:00 Mark Thomas <ma...@apache.org>:
> 
>> How would a message get into the socket buffer? The client needs a
>> session to write a message and it won't get one until connectToServer
>> returns.
>>
> You misunderstood it, the client opens the connection, and the server
> sends back a message during onOpen, which may get in the socket buffer of
> the client and call onMessage right away. That's a really rare scenario and
> I'm not sure it is as intended since it is inconsistent (but fixing it may
> not be worth it).

Ah, OK. Now I understand what you mean.

It was written that way as messages written by the server as soon as the
connection opened were not being seen by the client (or were being
delayed until the next message was sent).

The behaviour is what I intended but I agree it is inconsistent.

I guess it is possible that a message being received before
connectToServer() has returned might cause issues but even if we moved
the notification to another thread then that could still happen.

My vote is for not worrying about this now and come back to it in the
unlikely event that it causes an issue. What I will do is add a comment
to the code to explain the above.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to