mirror of
https://github.com/impact-eintr/netstack.git
synced 2025-10-07 22:01:17 +08:00
快速重传失效了
This commit is contained in:
@@ -2,12 +2,10 @@ package loopback
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"netstack/logger"
|
||||
"netstack/tcpip"
|
||||
"netstack/tcpip/buffer"
|
||||
"netstack/tcpip/stack"
|
||||
"time"
|
||||
)
|
||||
|
||||
type endpoint struct {
|
||||
@@ -49,11 +47,11 @@ func (e *endpoint) WritePacket(r *stack.Route, hdr buffer.Prependable, payload b
|
||||
vv := buffer.NewVectorisedView(len(views[0])+payload.Size(), views)
|
||||
|
||||
// TODO 这里整点活 在特定的情况下丢掉数据报 模拟网络阻塞
|
||||
rand.Seed(time.Now().Unix())
|
||||
//rand.Seed(time.Now().Unix())
|
||||
//time.Sleep(time.Duration(rand.Intn(50)+50) * time.Millisecond)
|
||||
|
||||
e.count++
|
||||
if e.count == -1 { // 丢掉客户端写入的第二个包
|
||||
if e.count == 10 { // 丢掉客户端写入的第二个包
|
||||
logger.NOTICE(fmt.Sprintf("统计 %d 丢掉这个报文", e.count))
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user