libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Check for client disconnection on suspended connecti


From: Robert D Kocisko
Subject: Re: [libmicrohttpd] Check for client disconnection on suspended connection
Date: Mon, 29 Jul 2019 12:52:55 -0400

Thanks!

On Mon, Jul 29, 2019 at 12:50 PM Christian Grothoff <address@hidden> wrote:
On 7/29/19 6:28 PM, Robert D Kocisko wrote:
> Christian,
>
>>  do whatever syscall you fancy to find out if the client disconnected.
> Do you mean something like recv(fd, buffer, sizeof(buffer), MSG_PEEK |
> MSG_DONTWAIT)
> and check for it to return 0?

Yes. There might also be -1/errno combos to watch for.

> If so, once this returns 0
> is it safe to assume that I can resume the connection and it will
> disconnect without invoking my access handler callback?

It may still invoke your access handler callback, in fact if MHD is
still trying to *send*, that seems likely as MHD won't do recv() to
detect the client's disconnect state. However, in your callback, you
could simply return "MHD_NO" to force MHD to close down the connection
at that time.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]