all: Bunch of more linter fixes (#5500)
This commit is contained in:
@@ -257,17 +257,17 @@ func take(waiter waiter, tokens int) {
|
||||
if tokens < limiterBurstSize {
|
||||
// This is the by far more common case so we get it out of the way
|
||||
// early.
|
||||
waiter.WaitN(context.TODO(), tokens)
|
||||
_ = waiter.WaitN(context.TODO(), tokens)
|
||||
return
|
||||
}
|
||||
|
||||
for tokens > 0 {
|
||||
// Consume limiterBurstSize tokens at a time until we're done.
|
||||
if tokens > limiterBurstSize {
|
||||
waiter.WaitN(context.TODO(), limiterBurstSize)
|
||||
_ = waiter.WaitN(context.TODO(), limiterBurstSize)
|
||||
tokens -= limiterBurstSize
|
||||
} else {
|
||||
waiter.WaitN(context.TODO(), tokens)
|
||||
_ = waiter.WaitN(context.TODO(), tokens)
|
||||
tokens = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ next:
|
||||
continue
|
||||
}
|
||||
|
||||
c.SetDeadline(time.Now().Add(20 * time.Second))
|
||||
_ = c.SetDeadline(time.Now().Add(20 * time.Second))
|
||||
hello, err := protocol.ExchangeHello(c, s.model.GetHello(remoteID))
|
||||
if err != nil {
|
||||
if protocol.IsVersionMismatch(err) {
|
||||
@@ -214,7 +214,7 @@ next:
|
||||
c.Close()
|
||||
continue
|
||||
}
|
||||
c.SetDeadline(time.Time{})
|
||||
_ = c.SetDeadline(time.Time{})
|
||||
|
||||
// The Model will return an error for devices that we don't want to
|
||||
// have a connection with for whatever reason, for example unknown devices.
|
||||
@@ -569,7 +569,7 @@ func (s *Service) CommitConfiguration(from, to config.Configuration) bool {
|
||||
for addr, listener := range s.listeners {
|
||||
if _, ok := seen[addr]; !ok || listener.Factory().Valid(to) != nil {
|
||||
l.Debugln("Stopping listener", addr)
|
||||
s.listenerSupervisor.Remove(s.listenerTokens[addr])
|
||||
_ = s.listenerSupervisor.Remove(s.listenerTokens[addr])
|
||||
delete(s.listenerTokens, addr)
|
||||
delete(s.listeners, addr)
|
||||
}
|
||||
@@ -582,7 +582,7 @@ func (s *Service) CommitConfiguration(from, to config.Configuration) bool {
|
||||
s.natServiceToken = &token
|
||||
} else if !to.Options.NATEnabled && s.natServiceToken != nil {
|
||||
l.Debugln("Stopping NAT service")
|
||||
s.Remove(*s.natServiceToken)
|
||||
_ = s.Remove(*s.natServiceToken)
|
||||
s.natServiceToken = nil
|
||||
}
|
||||
|
||||
@@ -717,8 +717,8 @@ func warningFor(dev protocol.DeviceID, msg string) {
|
||||
}
|
||||
|
||||
func tlsTimedHandshake(tc *tls.Conn) error {
|
||||
tc.SetDeadline(time.Now().Add(tlsHandshakeTimeout))
|
||||
defer tc.SetDeadline(time.Time{})
|
||||
_ = tc.SetDeadline(time.Now().Add(tlsHandshakeTimeout))
|
||||
defer func() { _ = tc.SetDeadline(time.Time{}) }()
|
||||
return tc.Handshake()
|
||||
}
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ func (c internalConn) Close() {
|
||||
// *tls.Conn.Close() does more than it says on the tin. Specifically, it
|
||||
// sends a TLS alert message, which might block forever if the
|
||||
// connection is dead and we don't have a deadline set.
|
||||
c.SetWriteDeadline(time.Now().Add(250 * time.Millisecond))
|
||||
c.Conn.Close()
|
||||
_ = c.SetWriteDeadline(time.Now().Add(250 * time.Millisecond))
|
||||
_ = c.Conn.Close()
|
||||
}
|
||||
|
||||
func (c internalConn) Type() string {
|
||||
|
||||
@@ -83,7 +83,7 @@ func (t *tcpListener) Serve() {
|
||||
const maxAcceptFailures = 10
|
||||
|
||||
for {
|
||||
listener.SetDeadline(time.Now().Add(time.Second))
|
||||
_ = listener.SetDeadline(time.Now().Add(time.Second))
|
||||
conn, err := listener.Accept()
|
||||
select {
|
||||
case <-t.stop:
|
||||
|
||||
Reference in New Issue
Block a user