optimize comments

This commit is contained in:
xtaci
2025-12-12 22:36:34 +08:00
parent 9427d1ddeb
commit 651ba3b014
4 changed files with 5 additions and 3 deletions
+1
View File
@@ -50,6 +50,7 @@ func (bp *bufferPool) Get() []byte {
// Put returns a buffer to the pool.
func (bp *bufferPool) Put(buf []byte) {
// Only put back buffers of the correct size.
if cap(buf) != mtuLimit {
return
}
+1 -1
View File
@@ -292,7 +292,7 @@ RESET_TIMER:
s.recvbuf = make([]byte, size)
}
// resize the length of recvbuf to correspond to data size
// resize the length of recvbuf to match the data size
s.recvbuf = s.recvbuf[:size]
s.kcp.Recv(s.recvbuf) // read data to recvbuf first
n = copy(b, s.recvbuf) // then copy bytes to 'b' as many as possible
+1 -1
View File
@@ -29,7 +29,7 @@ import (
"golang.org/x/net/ipv4"
)
// defaultTx is the default procedure to transmit data
// defaultTx is the default transmission function for UDP sessions.
func (s *UDPSession) defaultTx(txqueue []ipv4.Message) {
nbytes := 0
npkts := 0
+2 -1
View File
@@ -31,7 +31,8 @@ import (
"golang.org/x/net/ipv4"
)
// tx is the optimized procedure to transmit packets utilizing the linux sendmmsg system call
// tx is the optimized procedure to transmit packets utilizing
// batch write syscall on linux platform.
func (s *UDPSession) tx(txqueue []ipv4.Message) {
// default version
if s.platform.batchConn == nil {