1. 31 Jan, 2014 9 commits
    • Olivier Crête's avatar
      Remove the "to" parameter from NiceOutputMessage · 5c235a86
      Olivier Crête authored
      We never send multiple messages to separate targets in practice, so
      this will simplify the code
      5c235a86
    • Philip Withnall's avatar
      agent: Add support for vectored I/O for sends · f7b15f14
      Philip Withnall authored
      Add one new public function, nice_agent_send_messages_nonblocking(),
      which replaces nice_agent_send_full(). This isn’t an API break, because
      nice_agent_send_full() hasn’t been in a release yet. The new API allows
      sending multiple messages in a single call, and supports vectors of
      buffers to transmit the messages from.
      
      The existing nice_agent_send() API has been left untouched, although
      it’s a bit of a bugbear because it’s non-blocking and doesn’t fit with
      the new *_nonblocking() naming scheme. Oh well.
      
      This doesn’t bring any notable changes to the number of memcpy()s on the
      critical path: it remains at zero for the common cases and common socket
      types. It introduces the possibility for future work to eliminate some
      memcpy()s in more complex socket types, like tcp-turn and tcp-bsd, but
      these optimisations have not been made yet. FIXME comments have been
      added.
      
      This includes modifications to the test-send-recv unit test to cover the
      new API.
      f7b15f14
    • Olivier Crête's avatar
      dcab7310
    • Olivier Crête's avatar
    • Olivier Crête's avatar
      outputstream: Don't wake up on every input buffer · b5f79391
      Olivier Crête authored
      So instead of actually blocking on the FD, block on a GCancellable
      which is triggered when the writable callback is called. Also set the
      application's GCancellable as a child of this source.
      b5f79391
    • Olivier Crête's avatar
      outputstream: Release blocking send lock while sending · 153bbf6b
      Olivier Crête authored
      Otherwise it produces a deadlock
      153bbf6b
    • Olivier Crête's avatar
      outputstream: Make the blocking send thread safe · 3da6767e
      Olivier Crête authored
      There was a possible race between disconnection and freeing of the WriteDatas
      structure, now it's ref-counted so it can never happen. Also set the len to -1
      if the cancellable was cancelled.
      3da6767e
    • Philip Withnall's avatar
    • Philip Withnall's avatar
      agent: Add support for GIO-style I/O streams · 949f979a
      Philip Withnall authored
      This adds three new classes:
       • NiceIOStream
       • NiceInputStream
       • NiceOutputStream
      which allow wrapping a single stream/component pair in an I/O stream
      which can be used with the standard GIO functions.
      
      The streams are constructed as wrappers around a NiceAgent, with changes
      to the NiceAgent’s properties affecting all instantiated streams.
      Streams are only supported for reliable connections.
      
      If the NiceAgent stream which underlies a NiceInputStream,
      NiceOutputStream or NiceIOStream is removed, the I/O stream is marked as
      closed.
      
      This is based on work originally done by Youness Alaoui
      <youness.alaoui@collabora.co.uk>.
      949f979a