Skip to content

Commit a6f9321

Browse files
committed
Fix channel creation got stuck
Changes: * Add a small delay before running the viewer to avoid race condition that leads to getting stuck in channel creation * Fix typo in viewer's configuration
1 parent b5e6477 commit a6f9321

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

webrtc-c/canary/src/CanaryWebrtc.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@ STATUS run(Canary::PConfig pConfig)
133133
viewerConfig.isMaster.value = FALSE;
134134

135135
ss << pConfig->clientId.value << "Viewer";
136-
masterConfig.clientId.value = ss.str();
136+
viewerConfig.clientId.value = ss.str();
137137
ss.str("");
138138

139139
ss << pConfig->channelName.value << "-viewer-" << timestamp;
140-
masterConfig.logStreamName.value = ss.str();
140+
viewerConfig.logStreamName.value = ss.str();
141141
ss.str("");
142142

143143
std::thread masterThread(runPeer, &masterConfig, timerQueueHandle, &masterRetStatus);
144+
THREAD_SLEEP(CANARY_DEFAULT_VIEWER_INIT_DELAY);
145+
144146
runPeer(&viewerConfig, timerQueueHandle, &retStatus);
145147
masterThread.join();
146148

webrtc-c/canary/src/Include.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
#define CANARY_DEFAULT_ITERATION_DURATION_IN_SECONDS 30
4444

45+
#define CANARY_DEFAULT_VIEWER_INIT_DELAY (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)
46+
4547
#define CANARY_MIN_DURATION (30 * HUNDREDS_OF_NANOS_IN_A_SECOND)
4648
#define CANARY_MIN_ITERATION_DURATION (15 * HUNDREDS_OF_NANOS_IN_A_SECOND)
4749

0 commit comments

Comments
 (0)