@@ -27,8 +27,6 @@ import (
2727type connState = int32
2828
2929const (
30- defaultZeroCopyTimeoutSec = 60
31-
3230 connStateNone = 0
3331 connStateConnected = 1
3432 connStateDisconnected = 2
@@ -39,21 +37,20 @@ type connection struct {
3937 netFD
4038 onEvent
4139 locker
42- operator * FDOperator
43- readTimeout time.Duration
44- readTimer * time.Timer
45- readTrigger chan error
46- waitReadSize int64
47- writeTimeout time.Duration
48- writeTimer * time.Timer
49- writeTrigger chan error
50- inputBuffer * LinkBuffer
51- outputBuffer * LinkBuffer
52- outputBarrier * barrier
53- supportZeroCopy bool
54- maxSize int // The maximum size of data between two Release().
55- bookSize int // The size of data that can be read at once.
56- state connState // Connection state should be changed sequentially.
40+ operator * FDOperator
41+ readTimeout time.Duration
42+ readTimer * time.Timer
43+ readTrigger chan error
44+ waitReadSize int64
45+ writeTimeout time.Duration
46+ writeTimer * time.Timer
47+ writeTrigger chan error
48+ inputBuffer * LinkBuffer
49+ outputBuffer * LinkBuffer
50+ outputBarrier * barrier
51+ maxSize int // The maximum size of data between two Release().
52+ bookSize int // The size of data that can be read at once.
53+ state connState // Connection state should be changed sequentially.
5754}
5855
5956var (
@@ -351,10 +348,6 @@ func (c *connection) init(conn Conn, opts *options) (err error) {
351348 case "tcp" , "tcp4" , "tcp6" :
352349 setTCPNoDelay (c .fd , true )
353350 }
354- // check zero-copy
355- if setZeroCopy (c .fd ) == nil && setBlockZeroCopySend (c .fd , defaultZeroCopyTimeoutSec , 0 ) == nil {
356- c .supportZeroCopy = true
357- }
358351
359352 // connection initialized and prepare options
360353 return c .onPrepare (opts )
@@ -483,9 +476,8 @@ func (c *connection) flush() error {
483476 if c .outputBuffer .IsEmpty () {
484477 return nil
485478 }
486- // TODO: Let the upper layer pass in whether to use ZeroCopy.
487479 bs := c .outputBuffer .GetBytes (c .outputBarrier .bs )
488- n , err := sendmsg (c .fd , bs , c .outputBarrier .ivs , false && c . supportZeroCopy )
480+ n , err := sendmsg (c .fd , bs , c .outputBarrier .ivs , false )
489481 if err != nil && err != syscall .EAGAIN {
490482 return Exception (err , "when flush" )
491483 }
0 commit comments