Files
netstack/tcpip/transport/tcp/connect.go
impact-eintr 5ca7a1858b 哇...tcp真的好复杂
目前网络层分发了数据包到tcp端,tcp的handlepacket把数据存到一个队列中并提醒事件驱动机制来取数据
取到数据后先进行一个解析 确认他是一个SYN包 然后解析SYN的相关选项
对于合法的数据包 开启一个goroutine去执行三次握手的第二步:返回确认包 TODO 返回确认包的实现
2022-12-06 18:02:18 +08:00

25 lines
495 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package tcp
import (
"log"
"netstack/tcpip"
)
// The following are used to set up sleepers.
const (
wakerForNotification = iota
wakerForNewSegment
wakerForResend
wakerForResolution
)
const maxSegmentsPerWake = 100
// protocolMainLoop 是TCP协议的主循环。它在自己的goroutine中运行负责握手、发送段和处理收到的段
func (e *endpoint) protocolMainLoop(handshake bool) *tcpip.Error {
for {
log.Println("三次握手机制在这里实现")
select {}
}
}