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);
|
||||
}
|
||||
if (!connected)
|
||||
{
|
||||
c.Disconnect();
|
||||
_clients.Remove(c);
|
||||
}
|
||||
}
|
||||
|
||||
public event ClientReadEventHandler ClientRead;
|
||||
|
@ -152,16 +157,16 @@ private void Process(object s, SocketAsyncEventArgs e)
|
|||
{
|
||||
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)
|
||||
{
|
||||
_clients.Add(T);
|
||||
T.ClientState += OnClientState;
|
||||
T.ClientRead += OnClientRead;
|
||||
T.ClientWrite += OnClientWrite;
|
||||
_clients.Add(client);
|
||||
client.ClientState += OnClientState;
|
||||
client.ClientRead += OnClientRead;
|
||||
client.ClientWrite += OnClientWrite;
|
||||
|
||||
OnClientState(T, true);
|
||||
OnClientState(client, true);
|
||||
}
|
||||
|
||||
e.AcceptSocket = null;
|
||||
|
|
Loading…
Reference in New Issue