Connection works but bugged
This commit is contained in:
parent
fa6d2902d7
commit
6f88142730
|
@ -4,6 +4,7 @@
|
|||
|
||||
package net.md_5.bungee.netty;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
@ -19,7 +20,12 @@ public class ChannelWrapper {
|
|||
|
||||
public synchronized void write(final Object packet) {
|
||||
if (!this.closed) {
|
||||
this.ch.write(packet);
|
||||
if(packet instanceof byte[]){
|
||||
this.ch.write(Unpooled.wrappedBuffer((byte[]) packet));
|
||||
}else {
|
||||
this.ch.write(packet);
|
||||
}
|
||||
|
||||
ch.unsafe().flushNow();
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1094,15 +1094,11 @@ public class EaglerAdapterImpl2 {
|
|||
|
||||
@Override
|
||||
public void onMessage(ByteBuffer arg0) {
|
||||
System.out.println("OnMessage called (important)");
|
||||
wasAbleToConnect = true;
|
||||
synchronized(socketSync) {
|
||||
readPackets.add(arg0.array());
|
||||
}
|
||||
currentException = null;
|
||||
for(int i = 0; i < readPackets.size(); i++){
|
||||
System.out.println(readPackets.get(i).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1144,7 +1140,6 @@ public class EaglerAdapterImpl2 {
|
|||
|
||||
public static final void writePacket(byte[] packet) {
|
||||
if(clientSocket != null && clientSocket.isOpen()) {
|
||||
//System.out.println("[EaglerAdapterImpl2] - Writing packet");
|
||||
clientSocket.send(ByteBuffer.wrap(packet));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue