There are something wrongs when no sendQueue message
yuancpfive opened this issue · comments
func (r *Rudp) sendMessage(tmp *packageBuffer) {
m := r.sendQueue.head
for m != nil {
tmp.packMessage(m)
m = m.next
}
// *** this is not correct when some situation
if r.sendQueue.head != nil {
if r.sendHistory.tail == nil {
r.sendHistory = r.sendQueue
} else {
r.sendHistory.tail.next = r.sendQueue.head
r.sendHistory.tail = r.sendQueue.tail
}
r.sendQueue.head = nil
r.sendQueue.tail = nil
}
}
if sendQueue is empty , and the program will never send sendHistory's message
or sendHistory's message will be sent when sendQueue contain message.