Skip to content

Commit 450ddf6

Browse files
committed
update vendors
1 parent 27f610b commit 450ddf6

File tree

5 files changed

+22
-55
lines changed

5 files changed

+22
-55
lines changed

epoll/epoll.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"go.osspkg.com/errors"
1616
"go.osspkg.com/ioutils"
17-
"go.osspkg.com/logx"
1817
netfd "go.osspkg.com/network/fd"
1918
"golang.org/x/sys/unix"
2019
)
@@ -133,9 +132,7 @@ func (v *_epoll) getWaited(list *[]int32) (int, error) {
133132
*list = append(*list, v.events[i].Fd)
134133
default:
135134
if err = v.closeConn(v.events[i].Fd); err != nil {
136-
v.cfg.Logger.WithFields(logx.Fields{
137-
"err": err.Error(),
138-
}).Errorf("Epoll close connect")
135+
v.cfg.Logger.Error("Epoll close connect", "err", err)
139136
}
140137
}
141138
}
@@ -198,19 +195,14 @@ func (v *_epoll) piping(ctx context.Context) {
198195
return
199196
}
200197
if !isClosedError(e) {
201-
v.cfg.Logger.WithFields(logx.Fields{
202-
"err": e.Error(),
203-
"ip": conn.Conn().RemoteAddr().String(),
204-
}).Warnf("Epoll handling connect")
198+
v.cfg.Logger.Warn("Epoll handling connect", "err", e, "ip", conn.Conn().RemoteAddr())
205199
return
206200
}
207201
e = v.closeConn(conn.FD())
208202
if e == nil || isClosedError(e) {
209203
return
210204
}
211-
v.cfg.Logger.WithFields(logx.Fields{
212-
"err": e.Error(),
213-
}).Errorf("Epoll close connect")
205+
v.cfg.Logger.Error("Epoll close connect", "err", e)
214206
}()
215207
}
216208
}

epoll/server_tcp.go

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ func (s *ServerTCP) init() (err error) {
6767
func (s *ServerTCP) ListenAndServe(ctx xc.Context) (err error) {
6868
defer func() {
6969
ctx.Close()
70-
s.Logger.WithFields(logx.Fields{
71-
"err": err.Error(),
72-
"ip": s.Config.Addr,
73-
}).Errorf("Epoll server stopped")
70+
s.Logger.Error("Epoll server stopped", "err", err, "ip", s.Config.Addr)
7471
}()
7572

7673
if err = s.init(); err != nil {
@@ -88,9 +85,7 @@ func (s *ServerTCP) ListenAndServe(ctx xc.Context) (err error) {
8885
s.wg.Background(func() {
8986
s.epollListen(ctx)
9087
})
91-
s.Logger.WithFields(logx.Fields{
92-
"ip": s.Config.Addr,
93-
}).Infof("Epoll server started")
88+
s.Logger.Info("Epoll server started", "ip", s.Config.Addr)
9489
s.wg.Wait()
9590
return
9691
}
@@ -106,16 +101,12 @@ func (s *ServerTCP) connAccept(ctx xc.Context) {
106101
case <-ctx.Done():
107102
return
108103
default:
109-
s.Logger.WithFields(logx.Fields{
110-
"err": err.Error(),
111-
}).Errorf("Epoll conn accept")
104+
s.Logger.Error("Epoll conn accept", "err", err)
112105
return
113106
}
114107
}
115108
if err = s.epoll.Accept(conn); err != nil {
116-
s.Logger.WithFields(logx.Fields{
117-
"err": err.Error(), "ip": conn.RemoteAddr().String(),
118-
}).Errorf("Epoll append connect")
109+
s.Logger.Error("Epoll append connect", "err", err, "ip", conn.RemoteAddr())
119110
}
120111
}
121112
}
@@ -126,9 +117,7 @@ func (s *ServerTCP) epollListen(ctx xc.Context) {
126117
}()
127118

128119
if err := s.epoll.Listen(ctx.Context()); err != nil {
129-
s.Logger.WithFields(logx.Fields{
130-
"err": err.Error(),
131-
}).Errorf("Epoll listen connects")
120+
s.Logger.Error("Epoll listen connects", "err", err)
132121
}
133122
fmt.Println(1)
134123
}

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ go 1.21
44

55
require (
66
go.osspkg.com/errors v0.3.1
7-
go.osspkg.com/ioutils v0.4.2
8-
go.osspkg.com/logx v0.3.3
7+
go.osspkg.com/ioutils v0.4.4
8+
go.osspkg.com/logx v0.4.1
99
go.osspkg.com/routine v0.3.1
1010
go.osspkg.com/syncing v0.3.0
1111
go.osspkg.com/xc v0.3.1
12-
golang.org/x/sys v0.22.0
12+
golang.org/x/sys v0.24.0
1313
)
1414

1515
require (

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ go.osspkg.com/casecheck v0.3.0 h1:x15blEszElbrHrEH5H02JIIhGIg/lGZzIt1kQlD3pwM=
66
go.osspkg.com/casecheck v0.3.0/go.mod h1:TRFXDMFJEOtnlp3ET2Hix3osbxwPWhvaiT/HfD3+gBA=
77
go.osspkg.com/errors v0.3.1 h1:F9m/EEd/Ot2jba/TV7tvVRIpWXzIpNLc7vRJKcBD86A=
88
go.osspkg.com/errors v0.3.1/go.mod h1:dKXe6Rt07nzY7OyKQNZ8HGBicZ2uQ5TKEoVFnVFOK44=
9-
go.osspkg.com/ioutils v0.4.2 h1:02b3bCweFFqWoNrnylIbrdfzQWwuL2tUI0wF0VOs/V4=
10-
go.osspkg.com/ioutils v0.4.2/go.mod h1:HybMFgE1PtVhLL23YJ6T7F9js7cmPgHoJL6Z02V7BOI=
11-
go.osspkg.com/logx v0.3.3 h1:txZj9e/DtZL7TVi3nk+lswYa/viQxbZzFButl6GlYSc=
12-
go.osspkg.com/logx v0.3.3/go.mod h1:+aKGveYkgnL3eJCg2lhiiKCfwjB1izU5QD8ZDuMAOk0=
9+
go.osspkg.com/ioutils v0.4.4 h1:1DCGtlPn0/OaoRgUxNzRcH1L3K90WyFRY6CPcKbWuMU=
10+
go.osspkg.com/ioutils v0.4.4/go.mod h1:58HhG2NHf9JUtixAH3R2XISlUmJruwVIUZ3039QVjOY=
11+
go.osspkg.com/logx v0.4.1 h1:EAzp6EfUmx3YurJrIO2heXIGLimi/RwlnxbM8Lpe8jY=
12+
go.osspkg.com/logx v0.4.1/go.mod h1:hz0oh9mu6Wo4+K6Yk59EbqYVj504FWqSDhEi71btM5g=
1313
go.osspkg.com/routine v0.3.1 h1:R0o4P0Ml5eoeHc2DiHjRvHBo/XXrW5nJNqIj3ToRzjg=
1414
go.osspkg.com/routine v0.3.1/go.mod h1:z5AvvTbB19/tt1E5JOb4POhK1tOPgmejajgao/IWn4s=
1515
go.osspkg.com/syncing v0.3.0 h1:yBkCsDPEt12a+qagInFFt7+ZongfT+GjSQl7nBmcybI=
1616
go.osspkg.com/syncing v0.3.0/go.mod h1:Dpe0ljlEG6cI2Y9PxEjKiYEX2sgs1eUjWNVjFu4/iB0=
1717
go.osspkg.com/xc v0.3.1 h1:6De75eXdP9CVXqgQOcCWLPyAqFw9zP5lM6rV9MLGiCE=
1818
go.osspkg.com/xc v0.3.1/go.mod h1:6dUG4Y/Q2NMhc5vYrNy0ehWIaHQtAi+MFfc22onQHEs=
19-
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
20-
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
19+
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
20+
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

server/server.go

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ func (v *_server) handlingUDP(ctx context.Context, l net.PacketConn) error {
120120
t := time.Now().Add(v.conf.Timeout)
121121
err := errors.Wrap(l.SetDeadline(t), l.SetReadDeadline(t), l.SetWriteDeadline(t))
122122
if err != nil {
123-
v.log.WithFields(logx.Fields{
124-
"err": err.Error(),
125-
}).Warnf("update deadline")
123+
v.log.Warn("UDP server: update deadline", "err", err)
126124
cancel()
127125
return
128126
}
@@ -157,10 +155,7 @@ func (v *_server) handlingUDP(ctx context.Context, l net.PacketConn) error {
157155

158156
v.handler.Handler(wBuff, rBuff, addr.String())
159157
if _, err0 := l.WriteTo(wBuff.Bytes(), addr); err0 != nil {
160-
v.log.WithFields(logx.Fields{
161-
"err": err0.Error(),
162-
"addr": addr.String(),
163-
}).Warnf("send message")
158+
v.log.Warn("UDP server: send message", "err", err0, "addr", addr)
164159
}
165160
})
166161
}
@@ -193,20 +188,14 @@ func (v *_server) handlingTCP(ctx context.Context, l net.Listener) error {
193188
t := time.Now().Add(v.conf.Timeout)
194189
err = errors.Wrap(conn.SetDeadline(t), conn.SetReadDeadline(t), conn.SetWriteDeadline(t))
195190
if err != nil {
196-
v.log.WithFields(logx.Fields{
197-
"err": err.Error(),
198-
"addr": conn.RemoteAddr().String(),
199-
}).Warnf("update deadline")
191+
v.log.Warn("TCP server: update deadline", "err", err, "addr", conn.RemoteAddr())
200192
conn.Close() // nolint: errcheck
201193
continue
202194
}
203195

204196
if tc, ok := conn.(*tls.Conn); ok {
205197
if err = tc.HandshakeContext(ctx); err != nil {
206-
v.log.WithFields(logx.Fields{
207-
"err": err.Error(),
208-
"addr": conn.RemoteAddr().String(),
209-
}).Warnf("handshake")
198+
v.log.Warn("TCP server: handshake", "err", err, "addr", conn.RemoteAddr())
210199
conn.Close() // nolint: errcheck
211200
continue
212201
}
@@ -229,10 +218,7 @@ func (v *_server) handlingTCP(ctx context.Context, l net.Listener) error {
229218
v.handler.Handler(cp, cp, cp.Addr())
230219
return
231220
} else {
232-
v.log.WithFields(logx.Fields{
233-
"err": err.Error(),
234-
"addr": conn.RemoteAddr().String(),
235-
}).Warnf("read message")
221+
v.log.Warn("TCP server: read message", "err", err, "addr", conn.RemoteAddr())
236222
}
237223
conn.Close() // nolint: errcheck
238224
})

0 commit comments

Comments
 (0)