xhs / librtcdc

Tiny portable WebRTC Data Channel in C.
Other
248 stars 39 forks source link

Hang forever because of role conflict #17

Closed Sfinx closed 8 years ago

Sfinx commented 8 years ago

Continue stressing the lib, now the bug is occurred at both sample clients, they just hang (do not pass the dtls->handshake_done flag) because both has the same role, debug from rtcdc.c-> startup_thread()

fprintf(stderr, "peer role: %s\n", (peer->role == RTCDC_PEER_ROLE_CLIENT) ? "client" : "server");

Output at both clients

RTCDC: ICE negotiation done
peer role: server
// SSL_do_handshake: -1
// hang here
  while (!peer->exit_thread && !dtls->handshake_done)
    g_usleep(100);

It is #occurred once per 20-30 connection attempts. Any ideas how to fix it ?

Sfinx commented 8 years ago

Ok, changed the RTCDC_PEER_ROLE_CLIENT in rtcdc.c to peer->role and set it manually using simple call/answer algo.