GNOME Bugzilla – Bug 621138
soup_server_new by socket
Last modified: 2014-05-02 13:23:06 UTC
We are implementing a server which includes the ability to "upgrade" itself in runtime (actually, just runs the upgraded version of itself as a separate process and pipes its current configuration including any open sockets). While this is primarily useful for XMPP sessions, which we would prefer not to interrupt to upgrade the server, we would also like the HTTP (BOSH) socket(s) to transfer so new connections queue in the time between when the old server stops accepting them and the new server is ready (vs being unable to connect). Being able to "pickle" a soup chunked session and transfer it to a new server instance would be even nicer, such that downloads are not interrupted for such a process, but are not as critical as the listening socket in our uses.
*** Bug 648551 has been marked as a duplicate of this bug. ***
The duplicate bug #648551 has a patch, although I haven't reviewed it or anything.
Created attachment 272032 [details] [review] Proposed implementation Here's a patch that actually works. It's used in a commercial product (a set-top-box). Please have a look. Cheers, Kris
Created attachment 272044 [details] [review] Proposed implementation Actually I adapted this patch to match with what's in master. BTW, see also this discussion: http://list-archives.org/2013/08/22/libsoup-list-gnome-org/patch-support-systemd-socket-activation-mechanism/f/4648578192 PS. Since Debian goes for systemd now, it's worth to make libsoup a good systemd citizen, isn't it? :) Thanks, Kris
oops, synchronicity. I implemented this (for the next release cycle) last week. See the "server-api" branch in git (though things may still change before it lands on master)
fixed in git master; the new SoupServer API allows setting up multiple listeners (after construct-time). You can use soup_server_listen_socket() to listen on a pre-existing GSocket, or soup_server_listen_fd() to listen on a pre-existing socket fd.