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:
parent
320e1554bd
commit
f175d322ae
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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) {}
|
||||
|
Loading…
Reference in New Issue
Block a user