1. 25 Sep, 2014 1 commit
  2. 23 Sep, 2014 1 commit
  3. 22 Sep, 2014 2 commits
    • Olivier Crête's avatar
      agent: Clear GSource timeout also for GUPnP timeout · 685cf0b4
      Olivier Crête authored
      Fix regressions introduced by the following patch:
      Clear existing GSource timeouts before adding new ones
      685cf0b4
    • Philip Withnall's avatar
      agent: Drop valid but unmatched STUN packets · b98b98ad
      Philip Withnall authored
      Rather than passing them through to the application. Invalid STUN
      packets are still passed through, but it causes unnecessary noise and
      corruption for higher-level applications to receive STUN packets they
      weren’t expecting.
      
      This is permitted by RFC 5389, §7.3.0:
          If any errors are detected, the message is silently discarded.
          In the case when STUN is being multiplexed with another protocol,
          an error may indicate that this is not really a STUN message; in
          this case, the agent should try to parse the message as a different
          protocol.
      where I interpret ‘error’ to mean ‘validation error’ rather than (e.g.)
      ‘unrecognised attribute’ or ‘unmatched response’ where the STUN packet
      is otherwise perfectly formed.
      b98b98ad
  4. 19 Sep, 2014 2 commits
    • Philip Withnall's avatar
      agent: Clear existing GSource timeouts before adding new ones · 5ed865fb
      Philip Withnall authored
      Modify agent_timeout_add_with_context() to force destroying and freeing
      of an existing GSource before overwriting it with a new one (probably
      with an updated timeout period).
      
      This fixes a case in priv_map_reply_to_relay_refresh() where the TURN
      candidate refresh timer was being overwritten with a new one, without
      the old one being destroyed. This lead to two timeouts existing, only
      one of which would be destroyed when the CandidateRefresh struct was
      freed, leaking the other one (in the main context) and allowing it to be
      later dispatched with a dangling CandidateRefresh pointer.
      
      The modification to agent_timeout_add_with_context() should prevent this
      happening in new code in future.
      5ed865fb
    • Philip Withnall's avatar
      agent: Add names to timer GSources · e5fbdbe6
      Philip Withnall authored
      Modify the agent_timeout_add_with_context() utility function to
      automatically add names to the timer GSources it creates. This makes
      them a little easier to identify when debugging.
      e5fbdbe6
  5. 01 Sep, 2014 2 commits
    • Olivier Crête's avatar
      agent: Put one StunAgent per Component · 8d53e347
      Olivier Crête authored
      Otherwise we risk running out of space in the space limited saved ids
      list. So the easiest way to do that is to put one StunAgent in each
      component. It may be advisable to just give up on not allocating
      memory inside libstun and just use a regular hash table in there
      instead.
      8d53e347
    • Philip Withnall's avatar
      agent: Agent can reach EOS after having received something · dcf3d71e
      Philip Withnall authored
      The agent can reach EOS after performing one or more non-empty reads in
      its read loop, and then hitting EOS on the underlying stream. That means
      reached_eos is TRUE, but n_valid_messages is non-zero.
      
      Weaken the postcondition to reflect this.
      dcf3d71e
  6. 27 Aug, 2014 2 commits
    • Philip Withnall's avatar
      agent: Fix locking when calling component_free() · 754596c8
      Philip Withnall authored
      As mentioned in the previous commit message, component_free() requires
      the agent lock to be released, but component_close() requires it to be
      held. Fix the locking in nice_agent_remove_stream() to do that.
      754596c8
    • Philip Withnall's avatar
      agent: Split component_free() into component_[close|free]() · 56e04b56
      Philip Withnall authored
      Closing a component and freeing it are slightly conceptually different.
      As it happens, freeing it can result in the disposal of the component's
      NiceIOStream, which requires the agent lock to be released — but closing
      the rest of the Component requires the agent lock to be held. Splitting
      the function up simplifies locking handling in other parts of the code
      (see next commit).
      56e04b56
  7. 25 Aug, 2014 2 commits
  8. 23 Aug, 2014 1 commit
    • Philip Withnall's avatar
      agent: Add missing stream-closed checks for pseudo-TCP · 67179ffd
      Philip Withnall authored
      This got lost in rebasing the FIN–ACK work. component->tcp is now only
      NULL before the pseudo-TCP stream is initially created — afterwards, it
      is always non-NULL, but pseudo_tcp_stream_is_closed() returns TRUE if
      the stream has closed (gracefully or on errors). This allows
      differentiation between the states: TCP support was never initialised;
      and TCP support was initialised but is now closed.
      67179ffd
  9. 21 Aug, 2014 5 commits
    • Philip Withnall's avatar
      agent: Handle EPIPE from pseudo_tcp_socket_send() · 480725bd
      Philip Withnall authored
      As with send(), pseudo_tcp_socket_send() may return EPIPE if the local
      side of the connection has been closed using close() or shutdown(). It
      currently doesn’t, but will do once pseudo-TCP FIN–ACK support has been
      implemented.
      480725bd
    • Philip Withnall's avatar
      agent: Don’t clear the PseudoTcpSocket on error · fe96a395
      Philip Withnall authored
      Instead, keep the closed object around. This allows differentiation
      between the states: TCP support was never initialised; and TCP support
      was initialised but is now closed.
      fe96a395
    • Philip Withnall's avatar
      agent: Tidy up a few variable references · 8abc3974
      Philip Withnall authored
      This simplifies the code a little. No functional changes.
      8abc3974
    • 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.
      ee109a91
    • Olivier Crête's avatar
      agent: Add "keepalive-conncheck" property to make keepalives be conncheck · 9d77c426
      Olivier Crête authored
      This is to use keepalives to check if the connection is still ongoing. If
      they don't get a reply, then we can assume that the connection has died.
      
      This needs to not happen in the case of ICE-TCP.
      9d77c426
  10. 25 Jul, 2014 2 commits
  11. 23 Jul, 2014 1 commit
    • Youness Alaoui's avatar
      Do not access component if it was destroyed when calling the io callback · 287f8a8b
      Youness Alaoui authored
      When calling component_emit_io_callback, the agent mutex will be unlocked before
      the callback is called, this can cause another thread to remove the
      stream and thus destroying the component. We must verify that the
      source was not destroyed after calling component_emit_io_callback
      and avoid accessing the component in that case.
      Bug report by Stephan Thamm in the mailing list.
      287f8a8b
  12. 12 Jul, 2014 1 commit
  13. 07 Jul, 2014 3 commits
  14. 17 May, 2014 15 commits