mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Fix a racing issue
This commit is contained in:
		@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					import 'dart:async';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import 'package:comunic/helpers/calls_helper.dart';
 | 
					import 'package:comunic/helpers/calls_helper.dart';
 | 
				
			||||||
import 'package:comunic/helpers/conversations_helper.dart';
 | 
					import 'package:comunic/helpers/conversations_helper.dart';
 | 
				
			||||||
import 'package:comunic/helpers/events_helper.dart';
 | 
					import 'package:comunic/helpers/events_helper.dart';
 | 
				
			||||||
@@ -229,8 +231,10 @@ class _CallScreenState extends SafeState<CallScreen> {
 | 
				
			|||||||
      peerConnection.onIceConnectionState = (c) {
 | 
					      peerConnection.onIceConnectionState = (c) {
 | 
				
			||||||
        print("New connection state: $c");
 | 
					        print("New connection state: $c");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (c == RTCIceConnectionState.RTCIceConnectionStateConnected)
 | 
					        if (c == RTCIceConnectionState.RTCIceConnectionStateConnected) {
 | 
				
			||||||
          CallsHelper.markPeerReady(convID);
 | 
					          // Add a delay of two seconds to avoid racing
 | 
				
			||||||
 | 
					          Timer(Duration(seconds: 2), () => CallsHelper.markPeerReady(convID));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      peerConnection.onSignalingState = (c) => print("New signaling state: $c");
 | 
					      peerConnection.onSignalingState = (c) => print("New signaling state: $c");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user