v4.6.9版本BUG

This commit is contained in:
yiyan 2019-04-15 21:54:25 +08:00
parent 70626f9b6f
commit 23885ea2b7
2 changed files with 12 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import com.ifish.entity.*;
import com.ifish.entity.event.QueueEventBody; import com.ifish.entity.event.QueueEventBody;
import com.ifish.entity.event.QueueEventEntity; import com.ifish.entity.event.QueueEventEntity;
import com.ifish.socketNew.model.receive.*; import com.ifish.socketNew.model.receive.*;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession; import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -76,18 +77,21 @@ public class SomeServer {
public void doSome(IoSession session, Object message) { public void doSome(IoSession session, Object message) {
//通配字符串 //通配字符串
if(message instanceof byte[]){ if(message instanceof byte[]){
byte[] bytes = (byte[]) message; byte[] bytes = (byte[]) message;
//长度 //长度
int length = bytes[14] & 0xff; int length = bytes[14] & 0xff;
//mac地址 //mac地址
IoBuffer ioBuffer = ByteUtil.byteToIoBuffer(bytes, length);
//类型
byte type = ioBuffer.get();
byte[] srcByte = new byte[6]; byte[] srcByte = new byte[6];
for (int i = 2; i < 8; i++) { for (int i = 2; i < 8; i++) {
srcByte[i-2] = bytes[i]; srcByte[i-2] = bytes[i];
} }
String strSrc = ByteUtil.bytesToHexString(srcByte); String strSrc = ByteUtil.bytesToHexString(srcByte);
//心跳 //心跳
if(length>=28){ if(type == 1){
sendToApp(session,strSrc, message); sendToApp(session,strSrc, message);
} }
else{ else{

View File

@ -128,6 +128,8 @@ public class ServerDecode implements ProtocolDecoder {
case 24:{ case 24:{
if(check_code==1){ if(check_code==1){
functionCode1(buf, out); functionCode1(buf, out);
}else{
out.write(bytes);
} }
break; break;
} }
@ -135,6 +137,8 @@ public class ServerDecode implements ProtocolDecoder {
case 25:{ case 25:{
if(check_code==0){ if(check_code==0){
functionCode0(buf, out); functionCode0(buf, out);
}else{
out.write(bytes);
} }
break; break;
} }
@ -142,6 +146,8 @@ public class ServerDecode implements ProtocolDecoder {
case 42:{ case 42:{
if(check_code==17){ if(check_code==17){
functionCode17(buf, out); functionCode17(buf, out);
}else{
out.write(bytes);
} }
break; break;
} }