Expose this error so pion/webrtc can handle gracefully.
rfc8839#section-5.1 specifies that a WebRTC Agent MUST
ignore any name/value pairs it doesn't understand.
Relates to pion/webrtc#1949
The webrtc-stats spec defines this field as:
> It is the protocol used by the endpoint to communicate with the TURN
> server. This is only present for local candidates. Valid values are
> "udp", "tcp", or "tls".
https://w3.org/TR/webrtc-stats/#dom-rtcicecandidatestats-relayprotocol
Instead check `closeCh` inside close. The current pattern
will cause issues if a packet is in flight.
The alternative is to add a nil check in writeTo, but that would
require locking around writes.
Resolves#247
Callers of run need to be able to cancel their waiting individually.
This would cause hung threads during restart if we attempted to close
a candidate while processing a packet for it.
Before the run would be canceled by the global close, but we can't
depend on that anymore.
Resolves#190
Remove taskChan and make .run just take an Agent wide mutex and run the
function. These is now a blocking operation so all channels used to
communicate from it must be buffered.
After this we will slowly remove usage of .run and make things more
thread safe.
Relates to #80, #67, #2
This implementation is not fully tested, and we don't
handle all error case yet. We will continue to work on it though.
Tests for send/recv and shutdown are in the works.
Relates to #47
This change will allow us to have custom logic and members
per interface type. Relay candidates will have a completely different
read loop, and candidate specific state.
Relates to #47