libmicrohttpd
[Top][All Lists]
Advanced

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

[libmicrohttpd] infinite loop even when connection is closed by client i


From: Leandro Santiago
Subject: [libmicrohttpd] infinite loop even when connection is closed by client in the create_response_from_callback when max < buffer size
Date: Wed, 19 Jan 2011 10:37:37 -0200

Hello to all. I'm streaming videos via http using libmicrohttpd.

To do it, I'm using the MHD_create_response_from_callback, using a callback with the interface:

static ssize_t video_generator(void* cls, uint64_t pos, char* buf, size_t max);

When I call MHD_create_function_from_callback, I'm passing the value 360000 as the block_size and MHD_SIZE_UNKNOWN as size;

The problem is sometimes the max value isn't 360000, but a lower value (16372).

As I can't work with this low value, I ask, in the beginning of video_generator:

if (max < 360000) return 0;

The problem is thereafter this function (video_generator) is called everytime, indefinitely, passing max as 16372 and the "pos" value as 0. Even if I close the connection (closing the client, for example), the video_generator callback continues indefinitely, with the same values (max = 16372 and pos = 0). So I need to kill the process.

For example, the above behavior happens when I use any webbrowser as client, but doesn't happen when I use mplayer (which supports http protocol).

What this function does is: everytime it's called, it sends one frame to the client.


reply via email to

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