@@ -97,7 +97,17 @@ class CTrivialSignalingClient : public ITrivialSignalingClient
9797 }
9898 signal.push_back (' \n ' );
9999
100+ // Simulate an unreliable signaling channel. Applied here rather than
101+ // in Send() so that only ICE signals are affected, not the connection
102+ // management greeting.
103+ if ( m_pOwner->m_nLossPct > 0 && ( rand () % 100 ) < m_pOwner->m_nLossPct )
104+ return true ;
105+
100106 m_pOwner->Send ( signal );
107+
108+ if ( m_pOwner->m_nDupPct > 0 && ( rand () % 100 ) < m_pOwner->m_nDupPct )
109+ m_pOwner->Send ( signal );
110+
101111 return true ;
102112 }
103113
@@ -182,15 +192,12 @@ class CTrivialSignalingClient : public ITrivialSignalingClient
182192 Connect ();
183193 }
184194
185- // Send the signal.
195+ // Send a raw line to the signaling server. No fault injection here;
196+ // fault injection for ICE signals lives in ConnectionSignaling::SendSignal.
186197 void Send ( const std::string &s )
187198 {
188199 assert ( s.length () > 0 && s[ s.length ()-1 ] == ' \n ' ); // All of our signals are '\n'-terminated
189200
190- // Simulate unreliable signaling channel: randomly drop signals.
191- if ( m_nLossPct > 0 && ( rand () % 100 ) < m_nLossPct )
192- return ;
193-
194201 sockMutex.lock ();
195202
196203 // If we're getting backed up, delete the oldest entries. Remember,
@@ -204,11 +211,6 @@ class CTrivialSignalingClient : public ITrivialSignalingClient
204211 }
205212
206213 m_queueSend.push_back ( s );
207-
208- // Simulate duplicate delivery.
209- if ( m_nDupPct > 0 && ( rand () % 100 ) < m_nDupPct )
210- m_queueSend.push_back ( s );
211-
212214 sockMutex.unlock ();
213215 }
214216
0 commit comments