Skip to content

Commit 258b9b0

Browse files
committed
test6
Signed-off-by: monkey92t <[email protected]>
1 parent ee22a8d commit 258b9b0

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

internal/pool/conn.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Conn struct {
1919
netConn net.Conn
2020

2121
// for checking the health status of the connection, it may be nil.
22-
rawConn syscall.RawConn
22+
sysConn syscall.Conn
2323

2424
rd *proto.Reader
2525
bw *bufio.Writer
@@ -60,7 +60,7 @@ func (cn *Conn) SetNetConn(netConn net.Conn) {
6060
}
6161

6262
func (cn *Conn) setRawConn() {
63-
cn.rawConn = nil
63+
cn.sysConn = nil
6464
conn := cn.netConn
6565
if conn == nil {
6666
return
@@ -70,9 +70,7 @@ func (cn *Conn) setRawConn() {
7070
}
7171

7272
if sysConn, ok := conn.(syscall.Conn); ok {
73-
if rawConn, err := sysConn.SyscallConn(); err == nil {
74-
cn.rawConn = rawConn
75-
}
73+
cn.sysConn = sysConn
7674
}
7775
}
7876

internal/pool/conn_check.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
var errUnexpectedRead = errors.New("unexpected read from socket")
1212

13-
func connCheck(rawConn syscall.RawConn) error {
13+
func connCheck(sysConn syscall.Conn) error {
1414
//// Reset previous timeout.
1515
//_ = conn.SetDeadline(time.Time{})
1616
//
@@ -22,10 +22,10 @@ func connCheck(rawConn syscall.RawConn) error {
2222
//if !ok {
2323
// return nil
2424
//}
25-
//rawConn, err := sysConn.SyscallConn()
26-
//if err != nil {
27-
// return err
28-
//}
25+
rawConn, err := sysConn.SyscallConn()
26+
if err != nil {
27+
return err
28+
}
2929

3030
var sysErr error
3131

internal/pool/conn_check_dummy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ import (
66
"syscall"
77
)
88

9-
func connCheck(_ syscall.RawConn) error {
9+
func connCheck(_ syscall.Conn) error {
1010
return nil
1111
}

internal/pool/pool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,10 @@ func (p *ConnPool) isHealthyConn(cn *Conn) bool {
511511
return false
512512
}
513513

514-
if cn.rawConn != nil {
514+
if cn.sysConn != nil {
515515
// reset previous timeout.
516516
_ = cn.netConn.SetDeadline(zeroTime)
517-
if connCheck(cn.rawConn) != nil {
517+
if connCheck(cn.sysConn) != nil {
518518
return false
519519
}
520520
}

0 commit comments

Comments
 (0)