File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
src/SocketIOClient/Transport Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,40 @@ private async Task OnOpened(OpenedMessage msg)
180180 Eio = EIO ,
181181 Query = _options . Query
182182 } ;
183- await SendAsync ( connectMsg . Write ( ) , CancellationToken . None ) . ConfigureAwait ( false ) ;
183+
184+ for ( int i = 1 ; i <= 3 ; i ++ )
185+ {
186+ try
187+ {
188+ await SendAsync ( connectMsg . Write ( ) , CancellationToken . None ) . ConfigureAwait ( false ) ;
189+ break ;
190+ }
191+ catch ( Exception e )
192+ {
193+ if ( i == 3 )
194+ Trace . TraceError ( e . ToString ( ) ) ;
195+ else
196+ await Task . Delay ( TimeSpan . FromMilliseconds ( Math . Pow ( 2 , i ) * 100 ) ) ;
197+ }
198+ }
199+ /*
200+ try
201+ {
202+ await Policy
203+ .Handle<Exception>()
204+ .WaitAndRetryAsync(3, attempt => TimeSpan.FromMilliseconds(Math.Pow(2, attempt) * 100))
205+ .ExecuteAsync(async () =>
206+ {
207+ await SendAsync(connectMsg.Write(), CancellationToken.None).ConfigureAwait(false);
208+ }).ConfigureAwait(false);
209+
210+ }
211+ catch (Exception e)
212+ {
213+ Trace.TraceError(e.ToString());
214+ OnTransportClosed();
215+ }
216+ */
184217 }
185218
186219 private async void OnTextReceived ( string text )
You can’t perform that action at this time.
0 commit comments