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: Christian Grothoff
Subject: Re: [libmicrohttpd] Check for client disconnection on suspended connection
Date: Mon, 29 Jul 2019 18:50:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

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.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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