mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
cmd: graceful close the connection
This commit is contained in:
parent
562c287a4e
commit
e2415857b0
|
@ -58,7 +58,12 @@ var userDataStreamCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("connected")
|
log.Infof("connected")
|
||||||
defer s.Close()
|
defer func() {
|
||||||
|
log.Infof("closing connection...")
|
||||||
|
if err := s.Close(); err != nil {
|
||||||
|
log.WithError(err).Errorf("connection close error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
cmdutil.WaitForSignal(ctx, syscall.SIGINT, syscall.SIGTERM)
|
cmdutil.WaitForSignal(ctx, syscall.SIGINT, syscall.SIGTERM)
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user