In D15706#336215, @micchie.gml_gmail.com wrote:In D15706#336214, @jtl wrote:In D15706#336213, @micchie.gml_gmail.com wrote:In D15706#335628, @rwatson wrote:In D15706#334870, @micchie.gml_gmail.com wrote:In D15706#334711, @jtl wrote:In D15706#334605, @rwatson wrote:Didn't quite catch this before it was committed. This isn't really a destructor, it's a close notification. Rather than confuse matters, as sockets have UMA destructors as well, this should probably be so_notify_close.
Yes, I caught that when I asked the submitter about the placement of the "destructor". But, once I figured out it was a close notification, I should have changed the name. Mea cupla.
Before changing this, let me see if I can confirm what the Linux implementation does.
Thanks, it is intended to be equivalent to sk_destruct() callback in struct sock in Linux.
Is the Linux sk_destruct called on socket close, or on socket destruction? If we want an actual socket destructor, we can add one of those [instead / as well], called from the socket destructor function.
It is literally destructor, which is called when the final reference count drops to zero. So probably we should define so_dtor() as destructor (so keep the name) and call it after SOCK_UNLOCK() in sofree(). (in Linux it is invoked without locking socket).
Which behavior do you want? As @rwatson indicated, you can both have a destructor and a close callback.
Just the destructor behaviour should suffice, but let me come back soon after checking.
I confirmed that the destructor behavior i.e., invoke it after SOCK_UNLOCK() in sofree() as below.
Or should I submit a new patch?