aiortc stun error in case of many clients

32 Views Asked by At

Using aiortc i am trying to find the solution of the above error in case of 2 client peers connected to one server python peer. The connections are corrupted after few seconds.

The error:

Task exception was never retrieved
future: <Task finished name='Task-9232' coro=<RTCSctpTransport._data_channel_flush() done, defined at C:\Python\Lib\site-packages\aiortc\rtcsctptransport.py:1642> exception=ConnectionError('Cannot send encrypted data, not connected')>
Traceback (most recent call last):
  File "C:\Python\Lib\site-packages\aiortc\rtcsctptransport.py", line 1673, in _data_channel_flush
    await self._send(
  File "C:\Python\Lib\site-packages\aiortc\rtcsctptransport.py", line 1330, in _send
    await self._transmit()
  File "C:\Python\Lib\site-packages\aiortc\rtcsctptransport.py", line 1553, in _transmit
    await self._send_chunk(chunk)
  File "C:\Python\Lib\site-packages\aiortc\rtcsctptransport.py", line 1337, in _send_chunk
    await self.__transport._send_data(
  File "C:\Python\Lib\site-packages\aiortc\rtcdtlstransport.py", line 647, in _send_data
    raise ConnectionError("Cannot send encrypted data, not connected")
ConnectionError: Cannot send encrypted data, not connected

traceback of the error:

https://github.com/aiortc/aiortc/blob/main/src/aiortc/rtcdtlstransport.py#L646 https://github.com/aiortc/aiortc/blob/main/src/aiortc/rtcdtlstransport.py#L518 https://github.com/aiortc/aioice/blob/main/src/aioice/ice.py#L589 https://github.com/aiortc/aioice/blob/main/src/aioice/ice.py#L542 https://github.com/aiortc/aioice/blob/main/src/aioice/ice.py#L1006 https://github.com/aiortc/aioice/blob/main/src/aioice/ice.py#L1001 https://github.com/aiortc/aioice/blob/main/src/aioice/stun.py#L265 https://github.com/aiortc/aioice/blob/main/src/aioice/stun.py#L306

It seems that aioice doesn't work well in case of two client peers.

the configuration of RTCPeerConnection client side is:

    var config = {
        sdpSemantics: 'unified-plan'
    };
    config.iceServers = [{ urls: ['stun:stun.l.google.com:19302'] }];

What's going wrong around and how can i fix it?

0

There are 0 best solutions below