1. 22 Sep, 2014 5 commits
    • 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
    • Philip Withnall's avatar
      agent: Remove dangling pointers on NiceSocket destruction · f6337b53
      Philip Withnall authored
      If a NiceSocket is destroyed, various pointers are currently left
      dangling to it in the conncheck state. These can cause crashes if (for
      example) a CandidateCheckPair with such a dangling pointer is then used;
      the GSocket methods will fail.
      
      Fix this by explicitly removing the socket and all NiceCandidates which
      wrap it from various areas of the state.
      f6337b53
    • Philip Withnall's avatar
      agent: Factor out state transition to FAILED for CandidateCheckPairs · 6c8856bb
      Philip Withnall authored
      This introduces no functional changes.
      6c8856bb
    • Philip Withnall's avatar
      e3dac3eb
    • Philip Withnall's avatar
      agent: Improve comments for container element types · 21b0fee0
      Philip Withnall authored
      To allow enhanced grepping for what structs point to other structs.
      21b0fee0
  2. 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
  3. 02 Sep, 2014 2 commits
  4. 01 Sep, 2014 4 commits
  5. 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
  6. 25 Aug, 2014 3 commits
  7. 23 Aug, 2014 2 commits
    • 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
    • Philip Withnall's avatar
      agent: Return 0 on EOS from nice_input_stream_read() · 7b6935c6
      Philip Withnall authored
      We should return 0 instead of G_IO_ERROR_CLOSED for consistency with
      recv() and read().
      7b6935c6
  8. 21 Aug, 2014 20 commits