Strange behaviour of wip_getState()

Hi all,

Initially (before wip_setOpts etc.) wip_getState() return “WIP_CSTATE_INIT” or “WIP_CSTATE_BUSY” value
After socket is created returned value is WIP_CSTATE_READY. Everything is Ok here… But when it comes for event “WIP_CEV_PEER_CLOSE” and anytime after wip_getState() always retun WIP_CSTATE_READY.

Is it normal behaviour? If it is then it is very unuseful function and developer must invent his own statuses to track channel state :frowning:

any help/comment appreciated
Thanks,
Mark

In TCP, you shut down half connections. So when you receive WIP_CEV_PEER_CLOSE (corresponding to a FIN TCP flag), it means that the peer won’t send you more data, but you are still able to send data to it. Therefore the socket is still usable, and its state is “ready” indeed. It would be “broken” if a fatal error broke the connection (e.g. a WIP_CERR_ABORT, a violent bidirectional closing caused by the peer, often upon protocol violation).