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)
c.ohm.AddHandler(context.Background(), &Outbound{
if err := c.ohm.RemoveHandler(context.Background(), c.config.Tag); err != nil {
newError("failed to remove existing handler").WriteToLog()
}
return c.ohm.AddHandler(context.Background(), &Outbound{
tag: c.config.Tag,
listener: listener,
})
return nil
}
// Close implements common.Closable.

View File

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

View File

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