• Philip Withnall's avatar
    agent: Rearchitect message handling to use GErrors for EWOULDBLOCK · ee109a91
    Philip Withnall authored
    Previously, an EWOULDBLOCK return value from the low-level socket calls
    (including PseudoTcpSocket) would be represented by a zero number of
    bytes (or messages) read by the agent. This conflicts with the use of
    zero to represent end of stream (EOS) for pseudo-TCP connections, where
    the sender has indicated that they are not going to send any more bytes.
    So, now use GError (G_IO_ERROR_WOULD_BLOCK) to represent EWOULDBLOCK,
    just like the GSocket functions. Zero is reserved exclusively for if:
     • the number of requested bytes/messages is zero; or
     • reliable mode is enabled and EOS is reached.
    This does change the documented behaviour of the NiceAgent send/recv
    API, but only by allowing a new behaviour (returning zero) rather than
    by changing an existing one, so it should be OK.
agent.h 48 KB