Skip to content

Commit bfc2205

Browse files
committed
api: make DeadlineIO private
Part of #158
1 parent 8a60bb8 commit bfc2205

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
2727
- multi subpackage (#240)
2828
- msgpack.v2 support (#236)
2929
- pool/RoundRobinStrategy (#158)
30+
- DeadlineIO (#158)
3031

3132
### Fixed
3233

deadline_io.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import (
55
"time"
66
)
77

8-
type DeadlineIO struct {
8+
type deadlineIO struct {
99
to time.Duration
1010
c net.Conn
1111
}
1212

13-
func (d *DeadlineIO) Write(b []byte) (n int, err error) {
13+
func (d *deadlineIO) Write(b []byte) (n int, err error) {
1414
if d.to > 0 {
1515
d.c.SetWriteDeadline(time.Now().Add(d.to))
1616
}
1717
n, err = d.c.Write(b)
1818
return
1919
}
2020

21-
func (d *DeadlineIO) Read(b []byte) (n int, err error) {
21+
func (d *deadlineIO) Read(b []byte) (n int, err error) {
2222
if d.to > 0 {
2323
d.c.SetReadDeadline(time.Now().Add(d.to))
2424
}

dial.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (t TtDialer) Dial(address string, opts DialOpts) (Conn, error) {
111111
return nil, fmt.Errorf("failed to dial: %w", err)
112112
}
113113

114-
dc := &DeadlineIO{to: opts.IoTimeout, c: conn.net}
114+
dc := &deadlineIO{to: opts.IoTimeout, c: conn.net}
115115
conn.reader = bufio.NewReaderSize(dc, 128*1024)
116116
conn.writer = bufio.NewWriterSize(dc, 128*1024)
117117

0 commit comments

Comments
 (0)