mirror of
https://github.com/xtaci/kcp-go.git
synced 2026-10-19 16:14:38 +00:00
optimize comments
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user