Skip to content

Commit 0443ecb

Browse files
committed
Fixed UnhandledExcaption after 20 hours #18
1 parent baa0f57 commit 0443ecb

File tree

11 files changed

+99
-24
lines changed

11 files changed

+99
-24
lines changed

Src/EngineIoClientDotNet.Tests.mono/ClientTests/ServerConnectionTest.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22

3+
using System;
34
using System.Collections.Generic;
5+
using System.Threading.Tasks;
46
using Quobject.EngineIoClientDotNet.Client;
57
using Quobject.EngineIoClientDotNet.Client.Transports;
68
using Quobject.EngineIoClientDotNet.ComponentEmitter;
@@ -63,6 +65,7 @@ public void OpenAndClose()
6365
[Fact]
6466
public void Messages()
6567
{
68+
LogManager.Enabled = true;
6669

6770
var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());
6871
log.Info("Start");
@@ -446,6 +449,58 @@ public void UpgradeCookie()
446449
// Assert.Equal("got cookie", result);
447450
//}
448451

452+
453+
// [Fact]
454+
//public void MessagesMulti()
455+
//{
456+
// LogManager.Enabled = true;
457+
458+
// var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());
459+
// log.Info("Start");
460+
// _manualResetEvent = new ManualResetEvent(false);
461+
462+
// var events = new ConcurrentQueue<string>();
463+
464+
// int count = 200;
465+
466+
// var socket = new Socket(CreateOptions());
467+
// socket.On(Socket.EVENT_OPEN, () =>
468+
// {
469+
// log.Info("EVENT_OPEN");
470+
471+
// Task.Run(() =>
472+
// {
473+
// for (int i = 0; i < count; i++)
474+
// {
475+
// socket.Send("multi");
476+
// Task.Delay(TimeSpan.FromSeconds(1)).Wait();
477+
// }
478+
479+
// });
480+
481+
482+
// });
483+
// socket.On(Socket.EVENT_MESSAGE, (d) =>
484+
// {
485+
// var data = (string)d;
486+
// log.Info("EVENT_MESSAGE data = " + data);
487+
// events.Enqueue(data);
488+
// if (events.Count > count)
489+
// {
490+
// _manualResetEvent.Set();
491+
// }
492+
// });
493+
// socket.Open();
494+
// _manualResetEvent.WaitOne();
495+
// socket.Close();
496+
497+
// string result;
498+
// events.TryDequeue(out result);
499+
// Assert.Equal("hi", result);
500+
// events.TryDequeue(out result);
501+
// Assert.Equal("multi", result);
502+
//}
503+
449504
}
450505

451506
}

Src/EngineIoClientDotNet.Tests.net45/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.9.12")]
35-
[assembly: AssemblyFileVersion("0.9.12")]
34+
[assembly: AssemblyVersion("0.9.14")]
35+
[assembly: AssemblyFileVersion("0.9.14")]

Src/EngineIoClientDotNet.mono/Client/Socket.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,17 @@ internal void OnDrain()
390390

391391
for (int i = 0; i < this.PrevBufferLen; i++)
392392
{
393-
var callback = this.CallbackBuffer[i];
394-
if (callback != null)
393+
try
395394
{
396-
callback();
395+
var callback = this.CallbackBuffer[i];
396+
if (callback != null)
397+
{
398+
callback();
399+
}
400+
}
401+
catch (ArgumentOutOfRangeException)
402+
{
403+
//ignore
397404
}
398405
}
399406
//log.Info(string.Format("OnDrain2 PrevBufferLen={0} WriteBuffer.Count={1}", PrevBufferLen, WriteBuffer.Count));

Src/EngineIoClientDotNet.mono/Client/Socket_net35.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,17 @@ internal void OnDrain()
391391

392392
for (int i = 0; i < this.PrevBufferLen; i++)
393393
{
394-
var callback = this.CallbackBuffer[i];
395-
if (callback != null)
394+
try
396395
{
397-
callback();
396+
var callback = this.CallbackBuffer[i];
397+
if (callback != null)
398+
{
399+
callback();
400+
}
401+
}
402+
catch (ArgumentOutOfRangeException)
403+
{
404+
//ignore
398405
}
399406
}
400407

Src/EngineIoClientDotNet.net35/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.9.13")]
35-
[assembly: AssemblyFileVersion("0.9.13")]
34+
[assembly: AssemblyVersion("0.9.14")]
35+
[assembly: AssemblyFileVersion("0.9.14")]

Src/EngineIoClientDotNet.net45/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.9.13")]
35-
[assembly: AssemblyFileVersion("0.9.13")]
34+
[assembly: AssemblyVersion("0.9.14")]
35+
[assembly: AssemblyFileVersion("0.9.14")]

Src/EngineIoClientDotNet.netcore45/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.9.13")]
35-
[assembly: AssemblyFileVersion("0.9.13")]
34+
[assembly: AssemblyVersion("0.9.14")]
35+
[assembly: AssemblyFileVersion("0.9.14")]

Src/EngineIoClientDotNet.portable-win81+wpa81/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.9.13")]
35-
[assembly: AssemblyFileVersion("0.9.13")]
34+
[assembly: AssemblyVersion("0.9.14")]
35+
[assembly: AssemblyFileVersion("0.9.14")]

Src/EngineIoClientDotNet.portable-wpa81+wp81/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.9.13")]
35-
[assembly: AssemblyFileVersion("0.9.13")]
34+
[assembly: AssemblyVersion("0.9.14")]
35+
[assembly: AssemblyFileVersion("0.9.14")]

Src/EngineIoClientDotNet.windowsphone8/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.9.13")]
35-
[assembly: AssemblyFileVersion("0.9.13")]
34+
[assembly: AssemblyVersion("0.9.14")]
35+
[assembly: AssemblyFileVersion("0.9.14")]

0 commit comments

Comments
 (0)