mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 18:04:58 +01:00
parent
d677cde6d0
commit
51cfcfe79b
@ -160,16 +160,11 @@ func (j *SourceJob) serve(ctx context.Context, task *Task) {
|
||||
connChan := make(chan connChanMsg)
|
||||
|
||||
// Serve connections until interrupted or error
|
||||
outer:
|
||||
outer:
|
||||
for {
|
||||
|
||||
go func() {
|
||||
rwc, err := listener.Accept()
|
||||
if err != nil {
|
||||
connChan <- connChanMsg{rwc, err}
|
||||
close(connChan)
|
||||
return
|
||||
}
|
||||
connChan <- connChanMsg{rwc, err}
|
||||
}()
|
||||
|
||||
@ -178,8 +173,8 @@ outer:
|
||||
case rwcMsg := <-connChan:
|
||||
|
||||
if rwcMsg.err != nil {
|
||||
task.Log().WithError(err).Error("error accepting connection")
|
||||
break outer
|
||||
task.Log().WithError(rwcMsg.err).Error("error accepting connection")
|
||||
continue
|
||||
}
|
||||
|
||||
j.handleConnection(rwcMsg.conn, task)
|
||||
@ -187,11 +182,12 @@ outer:
|
||||
case <-ctx.Done():
|
||||
task.Log().WithError(ctx.Err()).Info("context")
|
||||
break outer
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
task.Log().Info("closing listener")
|
||||
|
||||
task.Enter("close_listener")
|
||||
defer task.Finish()
|
||||
err = listener.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user