no message

master
a7458969 2020-04-16 01:10:42 +08:00
parent df482915ec
commit ef03c1e8e4
1 changed files with 11 additions and 1 deletions

View File

@ -149,15 +149,25 @@ func (this *PackageReceiever) Write(input []byte, inputlen int) error {
}
// 还没完全收到一整包数据
if packlen < int32(inputlen) - 7{
return nil;
return nil
}
// 刚好等于一包数据
if packlen == int32(inputlen) - 7{
_,ok := <- this.cache_package
if !ok{
logger.LogDebugError("channel is closed")
return nil
}
this.cache_package <- this.pack_data[0:inputlen]
this.pack_len = 0
}
// 有两个包
if packlen < int32(inputlen) - 7 {
_,ok := <- this.cache_package
if !ok{
logger.LogDebugError("channel is closed")
return nil
}
this.cache_package <- this.pack_data[0:inputlen]
this.pack_len = 0
this.Write(this.pack_data[inputlen:],this.pack_len - int(packlen)) //下个包再去重组包