liuxiaolong
2019-06-01 3ff3a54564e8bd5fc158201b025b1d3a5336f460
set ErrRecvTimeout to ErrProtoState
1个文件已修改
12 ■■■■ 已修改文件
server.go 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server.go
@@ -19,7 +19,7 @@
    // responses
    SurveyTime time.Duration
    // RecvDeadline is the time until the next recived of the SURVEY times out.
    RecvDeadline time.Duration
    //RecvDeadline time.Duration
    // PollTime is minimal time between SURVEYS (The time between SURVEYS could be greater than this time
    // if the SURVEY process takes longer than that time)
    PollTime time.Duration
@@ -85,10 +85,10 @@
    if err != nil {
        return nil, err
    }
    err = sock.SetOption(mangos.OptionRecvDeadline, opt.RecvDeadline)
    if err != nil {
        return nil, err
    }
    //err = sock.SetOption(mangos.OptionRecvDeadline, opt.RecvDeadline)
    //if err != nil {
    //    return nil, err
    //}
    pubCtx, pubCancel := context.WithCancel(ctx)
    publisher, err = NewPublisher(pubCtx, urlPubSub)
@@ -150,7 +150,7 @@
    for {
        msg, err = d.sock.Recv()
        if err != nil {
            if err == mangos.ErrRecvTimeout {
            if err == mangos.ErrProtoState {
                // Timeout means I can add the current responses to the SET
                d.services.Add(responses)
                return