mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 13:33:13 +00:00
Bugfix
This commit is contained in:
@ -34,11 +34,11 @@ using Esyur.Data;
|
||||
|
||||
namespace Esyur.Net.TCP
|
||||
{
|
||||
public class TCPConnection: NetworkConnection
|
||||
{
|
||||
public class TCPConnection:NetworkConnection {
|
||||
|
||||
private KeyList<string, object> variables = new KeyList<string, object>();
|
||||
|
||||
public TCPServer Server { get; internal set; }
|
||||
|
||||
public KeyList<string, object> Variables
|
||||
{
|
||||
@ -47,5 +47,20 @@ namespace Esyur.Net.TCP
|
||||
return variables;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Connected()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
protected override void DataReceived(NetworkBuffer buffer)
|
||||
{
|
||||
Server?.Execute(this, buffer);
|
||||
}
|
||||
|
||||
protected override void Disconencted()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,15 +103,19 @@ namespace Esyur.Net.TCP
|
||||
|
||||
|
||||
|
||||
protected override void DataReceived(TCPConnection sender, NetworkBuffer data)
|
||||
|
||||
|
||||
internal bool Execute(TCPConnection sender, NetworkBuffer data)
|
||||
{
|
||||
var msg = data.Read();
|
||||
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
if (filter.Execute(msg, data, sender))
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SessionModified(TCPConnection session, string key, object newValue)
|
||||
@ -119,22 +123,34 @@ namespace Esyur.Net.TCP
|
||||
|
||||
}
|
||||
|
||||
protected override void ClientConnected(TCPConnection sender)
|
||||
protected override void ClientDisconnected(TCPConnection connection)
|
||||
{
|
||||
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
filter.Connected(sender);
|
||||
filter.Connected(connection);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ClientDisconnected(TCPConnection sender)
|
||||
public override void Add(TCPConnection connection)
|
||||
{
|
||||
connection.Server = this;
|
||||
base.Add(connection);
|
||||
}
|
||||
|
||||
public override void Remove(TCPConnection connection)
|
||||
{
|
||||
connection.Server = null;
|
||||
base.Remove(connection);
|
||||
}
|
||||
|
||||
protected override void ClientConnected(TCPConnection connection)
|
||||
{
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
filter.Disconnected(sender);
|
||||
filter.Disconnected(connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user