Source File
closed_conn.go
Belonging Package
github.com/tmc/go-iroh/internal/qng
package quicimport ()// A closedLocalConn is a connection that we closed locally.// When receiving packets for such a connection, we need to retransmit the packet containing the CONNECTION_CLOSE frame,// with an exponential backoff.type closedLocalConn struct {counter atomic.Uint32logger utils.LoggersendPacket func(net.Addr, packetInfo)}var _ packetHandler = &closedLocalConn{}// newClosedLocalConn creates a new closedLocalConn and runs it.func newClosedLocalConn( func(net.Addr, packetInfo), utils.Logger) packetHandler {return &closedLocalConn{sendPacket: ,logger: ,}}func ( *closedLocalConn) ( receivedPacket) {:= .counter.Add(1)// exponential backoff// only send a CONNECTION_CLOSE for the 1st, 2nd, 4th, 8th, 16th, ... packet arrivingif bits.OnesCount32() != 1 {return}.logger.Debugf("Received %d packets after sending CONNECTION_CLOSE. Retransmitting.", ).sendPacket(.remoteAddr, .info)}func ( *closedLocalConn) (error) {}func ( *closedLocalConn) (TransportErrorCode) {}// A closedRemoteConn is a connection that was closed remotely.// For such a connection, we might receive reordered packets that were sent before the CONNECTION_CLOSE.// We can just ignore those packets.type closedRemoteConn struct{}var _ packetHandler = &closedRemoteConn{}func newClosedRemoteConn() packetHandler {return &closedRemoteConn{}}func ( *closedRemoteConn) (receivedPacket) {}func ( *closedRemoteConn) (error) {}func ( *closedRemoteConn) (TransportErrorCode) {}
![]() |
The pages are generated with Golds v0.8.4. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |