mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-03 22:45:13 +08:00
修改网络底层
This commit is contained in:
@@ -19,7 +19,6 @@ type ITcpSocketServerReciver interface {
|
|||||||
OnConnected(pClient *SClient)
|
OnConnected(pClient *SClient)
|
||||||
OnDisconnect(pClient *SClient)
|
OnDisconnect(pClient *SClient)
|
||||||
OnRecvMsg(pClient *SClient, pPack *MsgBasePack)
|
OnRecvMsg(pClient *SClient, pPack *MsgBasePack)
|
||||||
VerifyPackType(packtype uint16) bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -175,7 +174,7 @@ func (slf *SClient) listendata(){
|
|||||||
fillsize,bfillRet,fillhead := pack.FillData(buff,buffDataSize)
|
fillsize,bfillRet,fillhead := pack.FillData(buff,buffDataSize)
|
||||||
//提交校验头
|
//提交校验头
|
||||||
if fillhead == true {
|
if fillhead == true {
|
||||||
if pack.PackSize>slf.tcpserver.MaxRecvPackSize || slf.tcpserver.iReciver.VerifyPackType(pack.PackType) == false {
|
if pack.PackSize>slf.tcpserver.MaxRecvPackSize {
|
||||||
service.GetLogger().Printf(service.LEVER_WARN, "VerifyPackType error clent id %d is disconnect %d,%d",slf.id,pack.PackType, pack.PackSize)
|
service.GetLogger().Printf(service.LEVER_WARN, "VerifyPackType error clent id %d is disconnect %d,%d",slf.id,pack.PackType, pack.PackSize)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,10 +114,7 @@ func (slf *TcpSocketPbService) OnDisconnect(pClient *network.SClient){
|
|||||||
slf.disconnEvent(pClient.GetId())
|
slf.disconnEvent(pClient.GetId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (slf *TcpSocketPbService) VerifyPackType(packtype uint16) bool{
|
|
||||||
_,ok := slf.mapMsg[packtype]
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
|
||||||
func (slf *MsgProcessor) Handle(pClient *network.SClient,pPack *network.MsgBasePack){
|
func (slf *MsgProcessor) Handle(pClient *network.SClient,pPack *network.MsgBasePack){
|
||||||
if info, ok := slf.mapMsg[pPack.PackType]; ok {
|
if info, ok := slf.mapMsg[pPack.PackType]; ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user