liuxiaolong
2020-12-25 534974025fa2d6c2afe583070df79c9dd0e1d4c2
add quit Signal
1个文件已修改
5 ■■■■■ 已修改文件
hbusc.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hbusc.go
@@ -6,6 +6,7 @@
    "encoding/json"
    "errors"
    "fmt"
    "os"
    "strconv"
    "sync"
    "time"
@@ -80,7 +81,7 @@
}
//Register
func Register(ctx context.Context, config *Config, ri *RegisterInfo) (*BHBus,error) {
func Register(ctx context.Context, q chan os.Signal, config *Config, ri *RegisterInfo) (*BHBus,error) {
    handle := &BHBus{
        conf: config,
        m: make(map[string]*sockServer),
@@ -113,7 +114,7 @@
loop:
    for {
        select {
        case <-ctx.Done():
        case <-q:
            return handle,errors.New("ctx is done")
        default:
            if msg == nil {