|
@@ -112,11 +112,10 @@ class ThreadServer<Client,Message> {
|
|
try {
|
|
try {
|
|
readClientData(infos);
|
|
readClientData(infos);
|
|
} catch( e : Dynamic ) {
|
|
} catch( e : Dynamic ) {
|
|
- try s.close() catch( e : Dynamic ) { };
|
|
|
|
t.socks.remove(s);
|
|
t.socks.remove(s);
|
|
if( !Std.is(e,neko.io.Eof) && !Std.is(e,neko.io.Error) )
|
|
if( !Std.is(e,neko.io.Eof) && !Std.is(e,neko.io.Error) )
|
|
logError(e);
|
|
logError(e);
|
|
- work(callback(clientDisconnected,infos.client));
|
|
|
|
|
|
+ work(callback(clientDisconnected,s,infos.client));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
while( true ) {
|
|
while( true ) {
|
|
@@ -207,17 +206,22 @@ class ThreadServer<Client,Message> {
|
|
try {
|
|
try {
|
|
s.write(data);
|
|
s.write(data);
|
|
} catch( e : Dynamic ) {
|
|
} catch( e : Dynamic ) {
|
|
- try s.close() catch( e : Dynamic ) { };
|
|
|
|
|
|
+ stopClient(s);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function stopClient( s : neko.net.Socket ) {
|
|
|
|
+ try s.shutdown(true,true) catch( e : Dynamic ) { };
|
|
|
|
+ }
|
|
|
|
+
|
|
// --- CUSTOMIZABLE API ---
|
|
// --- CUSTOMIZABLE API ---
|
|
|
|
|
|
public function clientConnected( s : neko.net.Socket ) : Client {
|
|
public function clientConnected( s : neko.net.Socket ) : Client {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- public function clientDisconnected( c : Client ) {
|
|
|
|
|
|
+ public function clientDisconnected( s : neko.net.Socket, c : Client ) {
|
|
|
|
+ try s.close() catch( e : Dynamic ) {};
|
|
}
|
|
}
|
|
|
|
|
|
public function readClientMessage( c : Client, buf : String, pos : Int, len : Int ) : { msg : Message, bytes : Int } {
|
|
public function readClientMessage( c : Client, buf : String, pos : Int, len : Int ) : { msg : Message, bytes : Int } {
|