1. 21 Jun, 2017 1 commit
    • Fabrice Bellet's avatar
      conncheck: fix the component failed transition · 07366a5b
      Fabrice Bellet authored
      This patch fixes the transition of a component from connecting to
      failed, that previously occured due to the propagation of the
      keep_timer_going variable, and to the final call to function
      priv_update_check_list_failed_components(), after the global agent
      timer was stopped.
      Previously, the code almost never entered to failed state, because the
      timer was going one, as long as the number of nominated pair was not
      enough, and as long as there were valid pairs not yet nominated. Even
      if all pair timers were over.
      The definition of the Failed state of a conncheck list is somewhat
      contradictory in the spec, depending on weather you read :
       * sect 5.7.4. "Computing States",
       "Failed:  In this state, the ICE checks have not completed successfully
       for this media stream."
       * sect "Check List and Timer State Updates",
       "If all of the pairs in the check list are now either in the Failed or
       Succeeded state: If there is not a pair in the valid list for each
       component of the media stream, the state of the check list is set to
      Our understanding of the ICE spec is that, the proper way to enter failed
      state instead in when all connchecks have no longer in-progress pairs.
      All pairs are either in state succeeded, discovered, or failed. No timer
      is still running, and we have no hope that the conncheck list changes
      again, except if an unexpected STUN packet arrives later. All pairs in
      frozen state is a special case, that is handled separately (sect
      A special grace delay is added before declaring a component in state
      Failed. This delay is not part of the RFC, and it is aimed to limit the
      cases when a conncheck list is reactivated just after it's been declared
      failed, causing a user visible transition from connecting to failed, and
      back from failed to connecting again. This is also required by the test
      suite, that counts exactly the number of time each state is entered, and
      doesn't expect these transcient failed states to happen (frequent due to
      the nature of the testsuite, less frequent in real life).
      Differential Revision: https://phabricator.freedesktop.org/D1111
  2. 12 Jun, 2017 2 commits
    • Fabrice Bellet's avatar
      conncheck: implement ice regular nomination method · 0636f9ad
      Fabrice Bellet authored
      This patch implements Regular Nomation as described in RFC5245 The controlling agent lets valid pairs accumulate, and
      decides which pair to recheck with the use-candidate attribute set.
      priv_mark_pair_nominated() follows, to update the nominated
      pair when acting as a STUN server, and
      priv_map_reply_to_conn_check_request() implements to
      update the nominated pair when acting as a STUN client. A new
      property is also added to the agent to control the nomination
      mode, which can be regular of aggressive, with default value
      set to aggressive.
      Two new flags are introduced in the CandidateCheckPair structure:
      - use_candidate_on_next_check indicates the STUN client to add the
        use-candidate attribute when the pair will be checked. At this
        time, the nominated flag has not been set on this pair yet.
      - mark_nominated_on_response_arrival indicates the STUN server
        to nominate the pair when its succesfull response to a
        previous triggered check will arrive (, item #2)
      Differential Revision: https://phabricator.freedesktop.org/D811
    • Fabrice Bellet's avatar
      stun timer: make properties for stun timer tunables · 8bb210c5
      Fabrice Bellet authored
      Three STUN binding request properties should be customisable. RFC 5245
      describes the retransmission timer of the STUN transaction 'RTO', and
      RFC 5389 describes the number of retransmissions to send until a
      response is received 'Rc'. The third property is the 'RTO' when
      a reliable connection is used.
      RFC 5389 introduces a supplementary property 'Rm' as a multiplier used
      to compute the final timeout RTO * Rm. However, this property is not
      added in libnice, because this would require breaking the public API for
      STUN. Currently, our STUN implementation hardcodes a division by two for
      this final timeout.
      Differential Revision: https://phabricator.freedesktop.org/D1109
  3. 11 Apr, 2017 1 commit
  4. 23 Jun, 2016 1 commit
  5. 30 May, 2016 1 commit
  6. 20 May, 2016 1 commit
  7. 04 Apr, 2016 1 commit
  8. 01 Oct, 2015 2 commits
  9. 03 Jul, 2015 1 commit
  10. 24 Jun, 2015 1 commit
  11. 09 Oct, 2014 1 commit
  12. 22 Sep, 2014 1 commit
  13. 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.
    • 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.
  14. 01 Sep, 2014 1 commit
    • 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
  15. 21 Aug, 2014 1 commit
  16. 17 May, 2014 2 commits
    • Youness Alaoui's avatar
      Add support for ICE-TCP · a6954838
      Youness Alaoui authored
      This is a massive commit that can't be split. We add ice-tcp support
      into the agent by creating local host tcp-active/tcp-passive candidates.
      We also need to find the local and remote candidates whenever we discover
      a peer-reflexive because their data is important to setup the peer-reflexive
      so a few changes were added to look for the local or remote candidate.
      For TCP-ACTIVE remote peer-reflexive candidates, we can't add conncheck
      pairs normally because TCP-PASSIVE (local) do not generate candidate pairs,
      and we also can't have a connection from any local host, so we can only create
      a single candidatepair with the local/remote that are connected.
      The pair->socket of a candidate check pair will hold the connected tcp socket
      (through connect for ACT or accept for PASS) and we will either have a
      remote or a local peer-reflexive which will create a new candidate pair,
      we cannot trigger checks on the initial candidate pair, we must only do it
      on the new check pairs. but in the case of a tcp-passive, we don't get a new
      local peer-reflexive candidate, so there is no new candidate with a new NiceSocket, so
      when we get a triggered check, we need to match it to the candidate check pair
      or when we select a pair, it will still use the original TCP-PASS socket.
      We must store the new connected tcp socket in the peer reflexive candidates
      since they represent that unique peer-reflx candidate's connection
    • Youness Alaoui's avatar
  17. 15 May, 2014 4 commits
  18. 24 Feb, 2014 3 commits
  19. 31 Jan, 2014 7 commits
    • Olivier Crête's avatar
    • Olivier Crête's avatar
      Remove the "length" parameter from NiceOutputMessage · 4f456a46
      Olivier Crête authored
      It was used correctly only half the time anyway
    • Philip Withnall's avatar
      socket: Add vectored I/O support for sending on sockets · 515481e6
      Philip Withnall authored
      Replace the send() API with a send_messages() API, which supports
      sending multiple messages, each with multiple buffers rather than a
      single monolithic buffer.
      This doesn’t break API, as the socket API is not exposed outside
      libnice. It does introduce a new struct: NiceOutputMessage, which is
      analogous to struct mmsghdr and NiceInputMessage.
      This includes updates to the test-bsd test to cover the changed API.
      The existing nice_socket_send() API has been retained as a thin wrapper
      around nice_socket_send_messages(), for convenience only. It’s hoped
      that internal usage of this API will decline to the point where it can
      be removed.
    • Philip Withnall's avatar
      agent: Add support for vectored I/O for receives · 253be348
      Philip Withnall authored
      Add two new public functions:
       • nice_agent_recv_messages()
       • nice_agent_recv_messages_nonblocking()
      which allow receiving multiple messages in a single call, and support
      vectors of buffers to receive the messages into.
      The existing nice_agent_recv[_nonblocking]() APIs have been left
      This tidies up a lot of the message handling code internally, and
      eliminates a couple of memcpy()s. There are still a few more memcpy()s
      on the critical path, which could be eliminated with further work.
      In the reliable agent case, every message is memcpy()ed twice: once into
      the pseudo-TCP receive buffer, and once out of it. The copy on input
      could be eliminated (in the case of in-order delivery of packets) by
      receiving directly into the receive buffer. The copy on output can’t be
      eliminated except in the I/O callback case (when
      nice_agent_attach_recv() has been used), in which case the callback
      could be invoked with a pointer directly into the pseudo-TCP receive
      In the non-reliable agent case, zero memcpy()s are used.
      A couple of the more complex socket implementations (TURN and HTTP) have
      slow paths during setup, and partially also during normal use. These
      could be optimised further, and FIXME comments have been added.
    • Philip Withnall's avatar
      socket: Add vectored I/O support for receiving on sockets · dfab04cd
      Philip Withnall authored
      Replace the recv() API with a recv_messages() API, which supports
      receiving multiple messages, each with multiple buffers rather than a
      single monolithic buffer.
      This doesn’t break API, as the socket API is not exposed outside
      libnice. It does introduce a new struct: NiceInputMessage, which is
      analogous to struct mmsghdr.
      This includes updates to the test-bsd test to cover the changed API.
    • Philip Withnall's avatar
      agent: Add nice_agent_recv() allowing blocking receives on sockets · 243c47ec
      Philip Withnall authored
      This is a blocking receive function, designed to be called from a worker
      thread. It cannot be used in conjunction with the existing
      nice_agent_attach_recv() API, as the blocking receive and the GSource
      would compete over access to the single copy of the data in the kernel’s
      receive buffer.
    • Philip Withnall's avatar
      agent: Move GSource handling into Component · c5672702
      Philip Withnall authored
      Rather than handle GSource creation, attachment and removal in
      NiceAgent, handle it inside Component. This brings it closer to the
      networking code, and improves encapsulation of the state of each
  20. 16 Feb, 2010 2 commits
  21. 04 Nov, 2009 1 commit
  22. 28 Jul, 2009 1 commit
  23. 17 Jun, 2009 1 commit
  24. 09 Jun, 2009 1 commit