g_output_stream_splice() does not end when stream is closed


I made a code to "bridge" 2 socket connections together. The idea is simple: I have 2 GSocketConnection objects, and I do
g_output_stream_splice_async (conn1.ostream, conn2.istream);
g_output_stream_splice_async (conn2.ostream, conn1.istream);

At some point, the socket of conn1 gets closed, so the first call to g_output_stream_splice_async() finishes and I get the callback. In that callback I do g_io_stream_close(conn2); but that does not ends the 2 call to g_output_stream_splice_async(), I never gets its callback...

Is that supposed to work? Or maybe I have to use a GCancellable to stop the 2nd splice when the first ends?

Xavier Claessens.

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