Change timeout
This commit is contained in:
		@@ -43,16 +43,14 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	for i = 1; ; i++ {
 | 
						for i = 1; ; i++ {
 | 
				
			||||||
		rtt := time.Now()
 | 
							rtt := time.Now()
 | 
				
			||||||
		ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
 | 
							ctx, cancel = context.WithTimeout(context.Background(), time.Second)
 | 
				
			||||||
		r, err := c.Ping(ctx, &pb.PingRequest{Data: data, Seq: i})
 | 
							r, err := c.Ping(ctx, &pb.PingRequest{Data: data, Seq: i})
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			log.Printf("could not connect to: %v", err)
 | 
								log.Printf("could not connect to: %v", err)
 | 
				
			||||||
			time.Sleep(1 * time.Second)
 | 
								time.Sleep(1 * time.Second)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// log.Printf("%d characters roundtrip to (%s): seq=%d time=%s", len(r.Data), address, r.Seq, time.Since(rtt))
 | 
					 | 
				
			||||||
		fmt.Printf("%d bytes from %s: seq=%d time=%s\n", len(r.Data), address, r.Seq, time.Since(rtt))
 | 
							fmt.Printf("%d bytes from %s: seq=%d time=%s\n", len(r.Data), address, r.Seq, time.Since(rtt))
 | 
				
			||||||
		//log.Printf("Received: %v", r.Data)
 | 
					 | 
				
			||||||
		time.Sleep(1 * time.Second)
 | 
							time.Sleep(1 * time.Second)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user