1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

fix lint warnings

This commit is contained in:
Darien Raymond 2018-04-14 13:09:58 +02:00
parent 320e1554bd
commit f175d322ae
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
3 changed files with 12 additions and 6 deletions

View File

@ -73,12 +73,14 @@ func (c *Commander) Start() error {
} }
}() }()
c.ohm.RemoveHandler(context.Background(), c.config.Tag) if err := c.ohm.RemoveHandler(context.Background(), c.config.Tag); err != nil {
c.ohm.AddHandler(context.Background(), &Outbound{ newError("failed to remove existing handler").WriteToLog()
}
return c.ohm.AddHandler(context.Background(), &Outbound{
tag: c.config.Tag, tag: c.config.Tag,
listener: listener, listener: listener,
}) })
return nil
} }
// Close implements common.Closable. // Close implements common.Closable.

View File

@ -10,6 +10,7 @@ import (
"v2ray.com/core/transport/ray" "v2ray.com/core/transport/ray"
) )
// OutboundListener is a net.Listener for listening gRPC connections.
type OutboundListener struct { type OutboundListener struct {
buffer chan net.Conn buffer chan net.Conn
done *signal.Done done *signal.Done
@ -19,9 +20,9 @@ func (l *OutboundListener) add(conn net.Conn) {
select { select {
case l.buffer <- conn: case l.buffer <- conn:
case <-l.done.C(): case <-l.done.C():
conn.Close() common.Ignore(conn.Close(), "We can do nothing if Close() returns error.")
default: default:
conn.Close() common.Ignore(conn.Close(), "We can do nothing if Close() returns error.")
} }
} }
@ -42,7 +43,7 @@ L:
for { for {
select { select {
case c := <-l.buffer: case c := <-l.buffer:
c.Close() common.Ignore(c.Close(), "We can do nothing if errored.")
default: default:
break L break L
} }

View File

@ -21,3 +21,6 @@ func Must2(v interface{}, err error) interface{} {
func Error2(v interface{}, err error) error { func Error2(v interface{}, err error) error {
return err return err
} }
// Ignore an error with reason, for lint purpose.
func Ignore(err error, reason string) {}