libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] MHD_suspend_connection and MHD_resume_connection wit


From: Denis Dowling
Subject: Re: [libmicrohttpd] MHD_suspend_connection and MHD_resume_connection with MHD_USE_POLL
Date: Thu, 9 Apr 2015 22:55:23 +0000

Hi Luke,

It seems to work but I still need to test more thoroughly. What I do is in the 
access handler callback, for requests that should be handled by a long poll I 
call MHD_suspend_connection(), then do MHD_create_response_from_callback() and 
return. When my application is ready to actually respond to the poll it calls 
MHD_resume_connection() on the connection. The event loop then wakes up and 
calls the callback registered with MHD_create_response_from_callback where I 
fill in the response on the first call and then return 
MHD_CONTENT_READER_END_OF_STREAM on the next call.

It took me a large amount of messing around to figure this all out. If you want 
I can throw together a small example that implements this.

Regards,
Denis


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Luke Dashjr
Sent: Thursday, 9 April 2015 6:48 PM
To: libmicrohttpd development and user mailinglist
Subject: Re: [libmicrohttpd] MHD_suspend_connection and MHD_resume_connection 
with MHD_USE_POLL

On Thursday, April 09, 2015 5:28:51 AM Denis Dowling wrote:
> Hi all,
>
> I was trying to use MHD_suspend_connection() and
> MHD_resume_connection() to implement long polling on a request. I am
> using options MHD_USE_SELECT_INTERNALLY and MHD_USE_POLL options. I
> noticed the server thread went to 100% CPU after the first 
> MHD_resume_connection() call.
> Looking at the code in MHD_poll_all() I can see that the file
> descriptor from daemon->wpipe[0] gets inserted into the list of file
> descriptors to poll but this file descriptor is never read so every
> time this function is called it returns immediately. The code works
> fine if I drop to using just MHD_USE_SELECT_INTERNALLY.
>
> The patch below fixes the problem.

Does it work besides that? I was never able to get it to work at all...

Luke

________________________________


The information contained in this message and any attachments is strictly 
confidential and intended solely for the use of the intended recipient(s). The 
copyright in this communication belongs to  (HSD). This message and any 
attachments are confidential and may be subject to legal or other professional 
privilege. Any confidentiality or privilege is not waived or lost because this 
e-mail has been sent to you by mistake. If you have received this transmission 
in error, please notify HSD on +61 3 9875 5900 immediately and destroy all 
copies of this e-mail. The contents of this email message may not be quoted, 
copied, reproduced or published in part or in whole, without the written 
authorisation of HSD.



reply via email to

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