Documentation bug...


I realised this morning that part of my "The life of a stream socket connection" document about the safe use of server callbacks in my server framework was wrong.

I said this:

At any time after a connection is established, including before you've had a chance to handle the connection establishment event, you might get a connection termination event.

and this:

Note that it IS possible that you could receive error, client disconnect, connection reset or connection closed events before or during the processing of the connection established callback. Due to this it is advisable not to access per-connection user data during the following calls: OnError(), OnConnectionClientClose(), OnConnectionReset() and OnConnectionClosed(). Also it is advisable to allocate and attach any per-connection user data before issuing the first read or write call.

This isn't strictly true. You can only receive OnError(), OnConnectionClientClose(), OnConnectionReset() or OnConnectionClosed() after you have issued at least one Read() or Write() call or after at least one TryRead() or TryWrite() call has returned true.

I've adjusted the original posting...

Leave a comment