mirror of
https://github.com/impact-eintr/netstack.git
synced 2025-10-07 13:50:58 +08:00
RTT 还是没整明白
This commit is contained in:
@@ -2,10 +2,12 @@ package loopback
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"netstack/logger"
|
||||
"netstack/tcpip"
|
||||
"netstack/tcpip/buffer"
|
||||
"netstack/tcpip/stack"
|
||||
"time"
|
||||
)
|
||||
|
||||
type endpoint struct {
|
||||
@@ -47,6 +49,8 @@ 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())
|
||||
//time.Sleep(time.Duration(rand.Intn(50)+50) * time.Millisecond)
|
||||
|
||||
e.count++
|
||||
if e.count == -1 { // 丢掉客户端写入的第二个包
|
||||
|
Reference in New Issue
Block a user