Longpoll with Libsoup



Hi,

I have a similar question to Mark's post about longpolling a few weeks
ago. I have a system that is doing lonpolling. However, I would like to
stop various backend work when the client disconnects. I haven't found a
way to get an event upon the client disconnecting.

What I've tried:

  Create a server, tried both sync and async w/ mainloop.
  Handle incoming request, pause message to simulate longpoll.
  Attach to various signals on the message's SoupSocket such as:
    - disconnect
    - event
  Get the raw FD for the socket w/ soup_socket_get_fd().
  Create a new GSource that poll's for (G_IO_ERR | G_IO_HUP) on FD.

It appears based on the code I've read that "disconnect" would be
unlikely to fire while the SoupMessage's IO is paused. (That is why I
tried the route of polling the FD myself with a custom GSource and
g_source_add_poll().

Anyway, still no luck as those poll conditions don't seem to fire.

For the client, I tried both curl and telnet w/ ^]quit.

Thanks for libsoup, it's fantastic.

-- Christian



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