Fix for issue #9 - 2

This commit is contained in:
sta
2012-10-26 14:58:50 +09:00
parent 2ae1d35d03
commit 746c883b82
71 changed files with 230 additions and 84 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Threading;
using WebSocketSharp;
using WebSocketSharp.Server;
@@ -6,8 +7,7 @@ namespace Example3 {
public class Chat : WebSocketService
{
private static object _forNum = new object();
private static uint _num = 0;
private static int _num = 0;
private string _name;
@@ -18,12 +18,9 @@ namespace Example3 {
: "anon#" + getNum();
}
private uint getNum()
private int getNum()
{
lock (_forNum)
{
return ++_num;
}
return Interlocked.Increment(ref _num);
}
protected override void OnOpen(object sender, EventArgs e)

Binary file not shown.

View File

@@ -14,6 +14,7 @@ namespace Example3
_httpsv = new HttpServer(4649);
_httpsv.AddService<Echo>("/Echo");
_httpsv.AddService<Chat>("/Chat");
//_httpsv.Sweeped = false; // Must be set after any AddService methods done.
_httpsv.OnGet += (sender, e) =>
{

Binary file not shown.

Binary file not shown.

Binary file not shown.