diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index b0fd73b2d..b6747c9f0 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -1243,6 +1243,7 @@ func (c *Direct) CustomPing(mr *tailcfg.MapResponse) bool { start := time.Now() // Run the ping var pingRes *ipnstate.PingResult + c.pinger.Ping(ip, true, func(res *ipnstate.PingResult) { log.Println("Callback", res, (res.NodeIP)) pingRes = res @@ -1251,6 +1252,7 @@ func (c *Direct) CustomPing(mr *tailcfg.MapResponse) bool { log.Println("Successful PING!") } }) + log.Println("PINGRES", pingRes) duration := time.Since(start) // Send the data to the handler in api.go admin/api/ping @@ -1260,7 +1262,6 @@ func (c *Direct) CustomPing(mr *tailcfg.MapResponse) bool { if err != nil { return false } - // time.Sleep(time.Millisecond * 100) resp, err := c.httpc.Do(request) if err != nil { return false diff --git a/tstest/integration/integration_test.go b/tstest/integration/integration_test.go index 6d63d59bf..4b886eea7 100644 --- a/tstest/integration/integration_test.go +++ b/tstest/integration/integration_test.go @@ -59,6 +59,7 @@ func TestMain(m *testing.M) { fmt.Fprintf(os.Stderr, "FAIL: %v\n", err) os.Exit(1) } + time.Sleep(5 * time.Second) os.Exit(0) } diff --git a/tstest/integration/testcontrol/testcontrol.go b/tstest/integration/testcontrol/testcontrol.go index c660fd676..ae00f9f73 100644 --- a/tstest/integration/testcontrol/testcontrol.go +++ b/tstest/integration/testcontrol/testcontrol.go @@ -269,6 +269,7 @@ func (s *Server) CompleteAuth(authPathOrURL string) bool { } func (s *Server) serveRegister(w http.ResponseWriter, r *http.Request, mkey tailcfg.MachineKey) { + log.Println("SERVE REGISTER CALLED") var req tailcfg.RegisterRequest if err := s.decode(mkey, r.Body, &req); err != nil { panic(fmt.Sprintf("serveRegister: decode: %v", err)) @@ -719,3 +720,8 @@ func (s *Server) receivePingInfo(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) io.WriteString(w, "Ping Streamed Back : "+string(reqBody)) } + +// TODO +// We want it such that we can add a pingrequest to a mapresponse instead of hard coding it. +func (s *Server) AddPingRequest() { +} diff --git a/wgengine/userspace.go b/wgengine/userspace.go index 196fa5c39..4e8432d5f 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -1198,7 +1198,8 @@ func (e *userspaceEngine) sendTSMPPing(ip netaddr.IP, peer *tailcfg.Node, res *i var data [8]byte crand.Read(data[:]) - log.Println("CRAND CHECK") + log.Println("CRAND CHECKlog") + fmt.Println("CRAND CHECKfmt") expireTimer := time.AfterFunc(10*time.Second, func() { log.Println("CHECKEXPIRE") @@ -1223,12 +1224,13 @@ func (e *userspaceEngine) sendTSMPPing(ip netaddr.IP, peer *tailcfg.Node, res *i log.Println("PAYLOADCHECK") tsmpPing := packet.Generate(iph, tsmpPayload[:]) - log.Println("PACKETGEN") + log.Println("PACKETGEN", string(tsmpPing), *res) e.tundev.InjectOutbound(tsmpPing) log.Println("TUNDEVINJECT") } func (e *userspaceEngine) setTSMPPongCallback(data [8]byte, cb func(packet.TSMPPongReply)) { + log.Println("Ponger2nolock") e.mu.Lock() log.Println("Ponger2", e.pongCallback == nil, cb == nil) defer e.mu.Unlock()