fix lint errors

pull/865/head
Darien Raymond 2018-02-12 21:35:10 +01:00
parent ae395bbe1f
commit 31d1fb6cc3
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 10 additions and 4 deletions

View File

@ -62,7 +62,9 @@ func (w *tcpWorker) callback(conn internet.Connection) {
newError("connection ends").Base(err).WriteToLog() newError("connection ends").Base(err).WriteToLog()
} }
cancel() cancel()
conn.Close() if err := conn.Close(); err != nil {
newError("failed to close connection").Base(err).WriteToLog()
}
} }
func (w *tcpWorker) Proxy() proxy.Inbound { func (w *tcpWorker) Proxy() proxy.Inbound {
@ -128,7 +130,7 @@ func (c *udpConn) Write(buf []byte) (int, error) {
} }
func (c *udpConn) Close() error { func (c *udpConn) Close() error {
common.Close(c.done) common.Must(c.done.Close())
return nil return nil
} }
@ -254,11 +256,15 @@ func (w *udpWorker) Start() error {
} }
func (w *udpWorker) Close() error { func (w *udpWorker) Close() error {
w.Lock()
defer w.Unlock()
if w.hub != nil { if w.hub != nil {
w.hub.Close() w.hub.Close()
w.done.Close()
common.Close(w.proxy)
} }
common.Must(w.done.Close())
common.Close(w.proxy)
return nil return nil
} }