A question about the old socket when RSSL_IP_FD_CHANGE is encountered

I am a newer using UPA API to construct my app. And I have a quick question about the old socket under some situation where the RSSL_IP_FD_CHANGE is returned
E.g. rsslInitChannel
My key question is: do I need cleaup the old socket after the unregistration IO of it? For example, should I explicitly close it or release it? at least in the documentation I didn’t see the cleanup. So UPA API has done it for me and only thing I should do is unregistering the IO notification bound?
My additional question (if possible) is : what if I don’t unregister the IO for old socket, is it harmful?

Best Answer

  • This
    socket is automatically cleaned up by the UPA API. You do not have to close it.

    It is harmful, because the system may reclaim the old file descriptor after
    it is closed, so it may get triggered if, for example, your application makes
    another connection and that FD is assigned to the new connection. So the old socket FD should be removed
    from your notifier when a FD_CHANGE event is received.