Disconnecting clients from SoupServer



Hi

I am using libsoup to write a web server application that delivers data at a constant rate to clients. As data becomes ready I call soup_message_body_append() and soup_server_unpause_message(), and I can monitor progress by connecting to the signals SoupMessage::wrote-chunk or SoupMessage::wrote-body-data.

If clients do not read the data fast enough or if they hang completely the server needs to disconnect the clients. How can this be done?

I have tried using soup_client_context_get_socket() to get the SoupSocket for the client connection and then calling soup_socket_disconnect(), hoping that this would trigger the same behaviour as when the client closes the TCP connection. But so far I have only ended up with a libsoup in an unusable state, where it usually segfaults at some random location shortly afterwarsd.

Is it safe calling soup_socket_disconnect() from a different thread than the one running GMainLoop? How about calling it from signal handlers, are there any that should be avoided? Are there alternatives to to soup_socket_disconnect() for disconnecting nonresponsive clients?

Regards
Rune Sætre


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