更改serverHandlerManager构造方法

This commit is contained in:
wangchao 2017-09-07 09:11:07 +08:00
parent ac0ee316ed
commit 7477e5f530
2 changed files with 4 additions and 5 deletions

View File

@ -56,7 +56,7 @@ public class ImServerAioHandler implements ServerAioHandler {
*/
@Override
public void handler(Packet packet, ChannelContext channelContext) throws Exception {
AbServerHandler handler = serverHandlerManager.getServerHandler(null,packet,channelContext);
AbServerHandler handler = serverHandlerManager.getServerHandler(null,channelContext);
if(handler != null){
handler.handler(packet, channelContext);
}
@ -73,7 +73,7 @@ public class ImServerAioHandler implements ServerAioHandler {
*/
@Override
public ByteBuffer encode(Packet packet, GroupContext groupContext, ChannelContext channelContext) {
AbServerHandler handler = serverHandlerManager.getServerHandler(null,packet,channelContext);
AbServerHandler handler = serverHandlerManager.getServerHandler(null,channelContext);
if(handler != null){
return handler.encode(packet, groupContext, channelContext);
}
@ -92,7 +92,7 @@ public class ImServerAioHandler implements ServerAioHandler {
*/
@Override
public Packet decode(ByteBuffer buffer, ChannelContext channelContext) throws AioDecodeException {
AbServerHandler handler = serverHandlerManager.getServerHandler(buffer,null,channelContext);
AbServerHandler handler = serverHandlerManager.getServerHandler(buffer,channelContext);
if(handler != null){
return handler.decode(buffer, channelContext);
}

View File

@ -10,7 +10,6 @@ import java.util.Map.Entry;
import org.apache.log4j.Logger;
import org.tio.core.ChannelContext;
import org.tio.core.intf.Packet;
import org.tio.server.ServerGroupContext;
/**
* 版本: [1.0]
@ -42,7 +41,7 @@ public class ServerHandlerManager{
return this;
}
public AbServerHandler getServerHandler(ByteBuffer buffer,Packet packet,ChannelContext channelContext){
public AbServerHandler getServerHandler(ByteBuffer buffer,ChannelContext channelContext){
for(Entry<String,AbServerHandler> entry : serverHandlers.entrySet()){
ByteBuffer copyByteBuffer = null;
if(buffer != null){