Update todos

This commit is contained in:
Simeng He 2021-05-19 15:55:29 -04:00
parent 16b8233459
commit da8b9adc51
4 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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)
}

View File

@ -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() {
}

View File

@ -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()