all: Revert the underscore sillyness

This commit is contained in:
Jakob Borg
2019-02-02 12:16:27 +01:00
parent 9fd270d78e
commit c2ddc83509
70 changed files with 252 additions and 252 deletions

View File

@@ -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
}
}

View File

@@ -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 func() { _ = tc.SetDeadline(time.Time{}) }()
tc.SetDeadline(time.Now().Add(tlsHandshakeTimeout))
defer tc.SetDeadline(time.Time{})
return tc.Handshake()
}

View File

@@ -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 {

View File

@@ -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: