e
e
This commit is contained in:
parent
91c4ce5360
commit
652beb947e
3 changed files with 15 additions and 6 deletions
2
protocol.txt
Normal file
2
protocol.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
CircleScape Protocol
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,8 @@ namespace CircleScape.Websocket {
|
|||
= new Dictionary<UInt64, Connection>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue