Small log additions for my own sake

This commit is contained in:
Simeng He
2021-05-10 12:24:07 -04:00
parent b40a69e846
commit f894fad4f7
3 changed files with 9 additions and 6 deletions

View File

@@ -7,6 +7,7 @@
import (
"context"
"fmt"
"log"
"sync"
"time"
@@ -157,6 +158,7 @@ func (c *Auto) Start() {
//
// It should be called whenever there's something new to tell the server.
func (c *Auto) sendNewMapRequest() {
log.Println("sendNewMapRequest breakpoint")
c.mu.Lock()
// If we're not already streaming a netmap, or if we're already stuck

View File

@@ -553,6 +553,7 @@ func inTest() bool { return flag.Lookup("test.v") != nil }
// maxPolls is how many network maps to download; common values are 1
// or -1 (to keep a long-poll query open to the server).
func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*netmap.NetworkMap)) error {
log.Println("POLLNETMAP BREAKPOINT")
return c.sendMapRequest(ctx, maxPolls, cb)
}
@@ -560,6 +561,7 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*netmap.N
// but does not fetch anything. It returns an error if the server did not return a
// successful 200 OK response.
func (c *Direct) SendLiteMapUpdate(ctx context.Context) error {
log.Println("SendLiteMapUpdate BREAKPOINT")
return c.sendMapRequest(ctx, 1, nil)
}
@@ -571,7 +573,7 @@ func (c *Direct) SendLiteMapUpdate(ctx context.Context) error {
// cb nil means to omit peers.
func (c *Direct) sendMapRequest(ctx context.Context, maxPolls int, cb func(*netmap.NetworkMap)) error {
c.mu.Lock()
log.Println("Sending a map request")
log.Println("sendMapRequest ENDPOINT")
persist := c.persist
serverURL := c.serverURL
serverKey := c.serverKey

View File

@@ -749,11 +749,6 @@ type MapRequest struct {
// * "minimize-netmap": have control minimize the netmap, removing
// peers that are unreachable per ACLS.
DebugFlags []string `json:",omitempty"`
// According to https://roamresearch.com/#/app/ts-corp/page/4Bn_Famn2
// Client can stream responses back.
// We will add a struct with the proper fields
PingResult *StreamedPingResult `json:",omitempty"`
}
// PortRange represents a range of UDP or TCP port numbers.
@@ -897,6 +892,10 @@ type PingRequest struct {
MaxPings int // MaxPings total, direct or DERPed
PayloadSize int // default: 0 extra bytes
}
// According to https://roamresearch.com/#/app/ts-corp/page/4Bn_Famn2
// Client can stream responses back.
// We will add a struct with the proper fields
type StreamedPingResult struct {
IP netaddr.IP
SeqNum int // somewhat redundant with TxID but for clarity