Currently GPollalbeOutputStream->writev_nonblocking
always allocates a GError
for _WOULD_BLOCK
results. This is not much efficient and can be quite expensive in networking scenarios. This MR extends the GPollalbeOutputStream
interface with an optional method that behaves identical to write_nonblockin
but returns a GPollableReturn
. The GError
is only allocated if the result is _FAILURE
variant of GPollableReturn
.
Additionally all the existing implementors of GPollalbeOutputStream
in gio
are extended to make use of the new API, to do that g_socket_send_with_timeout
from gsocket
was needed to become public.
Since the default implementation of g_pollable_output_stream_write_nonblocking
was switched to use _pollable
if available, that means it also stole the test coverage from GPollalbeOutputStream->writev_nonblocking
which was only tested indirectly. I am not sure how to introduce new tests for this since I don't think it was tested direclty. Extra help there would be much appreciated ^^.
g_pollable_output_stream_write_nonblocking_pollable
is a terrible name, but I couldn't come up with anything better. Feel free to bikeshed it :)
Also, note d8dc9d34, this MR is intended for 2.62+ but needed to get the CI to pass.