After two days banging my head with this, now I had a moment of enlightenment: the data remains in limbo, but it does not trigger the GSource because the GSocket/GSource has been created in the child process *after* the data has been already accepted by the kernel, and therefore the “data available” event never gets triggered.
What the child process can do is use g_socket_get_available_bytes() as the first thing right after creating the GSocket, and manually invoke the “data ready” callback.
@aperezdc Another option is to write a "child-ready" byte to the socket and the server blocks until that notification from the child.
Also, futex in shared memory, semaphore, etc to synchronize the startup.
Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!