| | |
| | | return errors.New("please init NNG first") |
| | | } |
| | | |
| | | // switch n.sock.GetProtocol().Number() { |
| | | // case mangos.ProtoSurveyor: |
| | | // time.Sleep(surveyorTime * 2) |
| | | // default: |
| | | // } |
| | | if surveyorTime > 0 { |
| | | time.Sleep(time.Duration(surveyorTime*2) * time.Second) |
| | | } |
| | | |
| | | if n.raw { |
| | | msg := mangos.NewMessage(len(data)) |
| | | msg.Body = data |
| | |
| | | // maxRecvSize max recv size |
| | | var ( |
| | | maxRecvSize = 33 * 1024 * 1024 |
| | | surveyorTime = time.Second / 2 |
| | | surveyorTime = -1 |
| | | ) |
| | | |
| | | func defualtSocketOptions() map[string]interface{} { |
| | |
| | | for _, arg := range args { |
| | | switch arg.(type) { |
| | | case int: |
| | | surveyorTime = time.Duration(arg.(int)/2) * time.Second |
| | | if arg.(int) < 2 { |
| | | surveyorTime = 1 |
| | | } else { |
| | | surveyorTime = arg.(int) / 2 |
| | | } |
| | | default: |
| | | } |
| | | options[mangos.OptionSurveyTime] = surveyorTime |
| | | options[mangos.OptionSurveyTime] = time.Duration(surveyorTime) * time.Second |
| | | } |
| | | default: |
| | | fmt.Println("no additional args") |