Hello,
I am using libmicrohttpd with MHD_OPTION_NOTIFY_CONNECTION parameter to receive notifications for TCP connection opening/closing. Notifications for opening case are coming through as expected, however I am experiencing problems with closing case, where I am NOT getting the callback when my client terminates, though I can see client FIN packet in tcpdump on the server side and connection stops appearing in netstat.
Eventually the closing notification is being delivered by libmicrohttpd but that is just after a new TCP connection is opened. The sequence of callbacks I am seeing is as followed:
1) callback with MHD_CONNECTION_NOTIFY_STARTED - TCP connection A opened
2) callback with MHD_CONNECTION_NOTIFY_STARTED - new TCP connection B is opened
3) callback with MHD_CONNECTION_NOTIFY_CLOSED - TCP connection A closed
Of course I would expect nr 3 to come before nr 2. I am using nc to open/close sockets on client end.
I would appreciate any comments on the described issue. Is that behavior correct? If not is there a way to make it right?
Kind regards,
Daniel