Skip to content

Commit

Permalink
Remove unnecessary indent blocks (#1586)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Jun 26, 2023
1 parent 6b68042 commit d229959
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
34 changes: 15 additions & 19 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,15 +944,13 @@ func clientGetURLDeadline(dst []byte, url string, deadline time.Time, c clientDo

statusCodeCopy, bodyCopy, errCopy := doRequestFollowRedirectsBuffer(req, dst, url, c)
mu.Lock()
{
if !timedout {
ch <- clientURLResponse{
statusCode: statusCodeCopy,
body: bodyCopy,
err: errCopy,
}
responded = true
if !timedout {
ch <- clientURLResponse{
statusCode: statusCodeCopy,
body: bodyCopy,
err: errCopy,
}
responded = true
}
mu.Unlock()

Expand All @@ -967,17 +965,15 @@ func clientGetURLDeadline(dst []byte, url string, deadline time.Time, c clientDo
err = resp.err
case <-tc.C:
mu.Lock()
{
if responded {
resp := <-ch
statusCode = resp.statusCode
body = resp.body
err = resp.err
} else {
timedout = true
err = ErrTimeout
body = dst
}
if responded {
resp := <-ch
statusCode = resp.statusCode
body = resp.body
err = resp.err
} else {
timedout = true
err = ErrTimeout
body = dst
}
mu.Unlock()
}
Expand Down
15 changes: 6 additions & 9 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1788,15 +1788,12 @@ func (s *Server) Serve(ln net.Listener) error {
maxWorkersCount := s.getConcurrency()

s.mu.Lock()
{
s.ln = append(s.ln, ln)
if s.done == nil {
s.done = make(chan struct{})
}

if s.concurrencyCh == nil {
s.concurrencyCh = make(chan struct{}, maxWorkersCount)
}
s.ln = append(s.ln, ln)
if s.done == nil {
s.done = make(chan struct{})
}
if s.concurrencyCh == nil {
s.concurrencyCh = make(chan struct{}, maxWorkersCount)
}
s.mu.Unlock()

Expand Down

0 comments on commit d229959

Please sign in to comment.