[common] udpate proto
This commit is contained in:
@@ -12,13 +12,13 @@ class NekoConnection<O:Message, I:Message> extends BaseConnection<O, I> {
|
||||
public function new(socket:Socket, i:Class<I>) {
|
||||
super(i);
|
||||
this.socket = socket;
|
||||
socket.setFastSend(true);
|
||||
socket.output.bigEndian = false;
|
||||
socket.input.bigEndian = false;
|
||||
//socket.setFastSend(true);
|
||||
//socket.output.bigEndian = false;
|
||||
//socket.input.bigEndian = false;
|
||||
sendHandler.connect(_send);
|
||||
}
|
||||
|
||||
override public function send(packet:O):Void {
|
||||
super.send(packet);
|
||||
private function _send(packet:O):Void {
|
||||
try {
|
||||
var b = new BytesOutput();
|
||||
packet.writeTo(b);
|
||||
@@ -26,9 +26,8 @@ class NekoConnection<O:Message, I:Message> extends BaseConnection<O, I> {
|
||||
socket.output.writeUInt16(bytes.length);
|
||||
socket.output.write(bytes);
|
||||
socket.output.flush();
|
||||
} catch (e:Dynamic) {
|
||||
trace("Error send packet: " + Type.getClassName(Type.getClass(packet)));
|
||||
trace(e);
|
||||
} catch (error:Dynamic) {
|
||||
L.e('Proto', 'Error send packet: ${packet}', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user