+ for _, addr := range ctx.Neigh[*node.Id].Addrs {
+ addrs = append(addrs, addr)
+ }
+ }
+
+ isGood := false
+ for _, addr := range addrs {
+ ctx.LogD("call", nncp.SDS{"addr": addr}, "dialing")
+ conn, err := net.Dial("tcp", addr)
+ if err != nil {
+ log.Println("Can not connect:", err)
+ continue
+ }
+ ctx.LogD("call", nncp.SDS{"addr": addr}, "connected")
+ state, err := ctx.StartI(conn, node.Id, nice, &xxOnly)
+ if err == nil {
+ ctx.LogI("call-start", nncp.SDS{"node": state.NodeId}, "connected")
+ state.Wait()
+ ctx.LogI("call-finish", nncp.SDS{
+ "node": state.NodeId,
+ "duration": strconv.FormatInt(int64(state.Duration.Seconds()), 10),
+ "rxbytes": strconv.FormatInt(state.RxBytes, 10),
+ "txbytes": strconv.FormatInt(state.TxBytes, 10),
+ "rxspeed": strconv.FormatInt(state.RxSpeed, 10),
+ "txspeed": strconv.FormatInt(state.TxSpeed, 10),
+ }, "")
+ isGood = true
+ conn.Close()
+ break
+ } else {
+ ctx.LogE("call-start", nncp.SDS{"node": state.NodeId, "err": err}, "")
+ conn.Close()
+ }
+ }
+ if !isGood {