diff --git a/protocol.txt b/protocol.txt new file mode 100644 index 0000000..b1723e5 --- /dev/null +++ b/protocol.txt @@ -0,0 +1,2 @@ +CircleScape Protocol + diff --git a/server/Websocket/Connection.cs b/server/Websocket/Connection.cs index 4060324..5cae9c1 100644 --- a/server/Websocket/Connection.cs +++ b/server/Websocket/Connection.cs @@ -1,11 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net.Sockets; using System.Text; using System.Threading.Tasks; namespace CircleScape.Websocket { class Connection { - + private TcpClient Socket; + + public Connection(TcpClient sock) { + Socket = sock; + } + + } } diff --git a/server/Websocket/Pool.cs b/server/Websocket/Pool.cs index 4501903..dcc267a 100644 --- a/server/Websocket/Pool.cs +++ b/server/Websocket/Pool.cs @@ -20,9 +20,8 @@ namespace CircleScape.Websocket { = new Dictionary(); public Pool() { - for(var i = 0; i < InitialCount; ++i) { - - } + for(var i = 0; i < InitialCount; ++i) + CreateThread(); } public bool AddConnection(Connection connection) { @@ -31,14 +30,15 @@ namespace CircleScape.Websocket { } } - private ThreadContext CreateThread(Connection initialConnection = null) { - var stack = new Stack(true); + private ThreadContext CreateThread(Connection initialConnection = null, bool runWithNoClients = false) { + var stack = new Stack(runWithNoClients, initialConnection); var ctx = new ThreadContext { Stack = stack, Thread = new Thread(new ThreadStart(stack.ManageStack)) }; Threads.Add(ctx); + updateFullThreadCount = true; return ctx; }