mirror of https://github.com/quasar/Quasar.git
Fixed #207
This commit is contained in:
parent
36ac738e43
commit
3e009117af
|
@ -33,6 +33,11 @@ private void OnClientState(Client c, bool connected)
|
||||||
{
|
{
|
||||||
ClientState(this, c, connected);
|
ClientState(this, c, connected);
|
||||||
}
|
}
|
||||||
|
if (!connected)
|
||||||
|
{
|
||||||
|
c.Disconnect();
|
||||||
|
_clients.Remove(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public event ClientReadEventHandler ClientRead;
|
public event ClientReadEventHandler ClientRead;
|
||||||
|
@ -152,16 +157,16 @@ private void Process(object s, SocketAsyncEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.SocketError == SocketError.Success)
|
if (e.SocketError == SocketError.Success)
|
||||||
{
|
{
|
||||||
Client T = new Client(this, e.AcceptSocket, PacketTypes.ToArray());
|
Client client = new Client(this, e.AcceptSocket, PacketTypes.ToArray());
|
||||||
|
|
||||||
lock (_clients)
|
lock (_clients)
|
||||||
{
|
{
|
||||||
_clients.Add(T);
|
_clients.Add(client);
|
||||||
T.ClientState += OnClientState;
|
client.ClientState += OnClientState;
|
||||||
T.ClientRead += OnClientRead;
|
client.ClientRead += OnClientRead;
|
||||||
T.ClientWrite += OnClientWrite;
|
client.ClientWrite += OnClientWrite;
|
||||||
|
|
||||||
OnClientState(T, true);
|
OnClientState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
e.AcceptSocket = null;
|
e.AcceptSocket = null;
|
||||||
|
|
Loading…
Reference in New Issue