no message
parent
df482915ec
commit
ef03c1e8e4
|
@ -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)) //下个包再去重组包
|
||||
|
|
Loading…
Reference in New Issue