From b43cf3370b7fc7b8df9df9c0fcafbe84aacd6dd3 Mon Sep 17 00:00:00 2001 From: Spike Curtis Date: Thu, 21 Dec 2023 15:13:32 +0400 Subject: [PATCH 1/2] fix: use TSMP for pings and checking reachability --- tailnet/conn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tailnet/conn.go b/tailnet/conn.go index c785e7fabbe96..3620cc5244390 100644 --- a/tailnet/conn.go +++ b/tailnet/conn.go @@ -670,12 +670,12 @@ func (c *Conn) Status() *ipnstate.Status { return sb.Status() } -// Ping sends a Disco ping to the Wireguard engine. +// Ping sends a ping to the Wireguard engine. // The bool returned is true if the ping was performed P2P. func (c *Conn) Ping(ctx context.Context, ip netip.Addr) (time.Duration, bool, *ipnstate.PingResult, error) { errCh := make(chan error, 1) prChan := make(chan *ipnstate.PingResult, 1) - go c.wireguardEngine.Ping(ip, tailcfg.PingDisco, func(pr *ipnstate.PingResult) { + go c.wireguardEngine.Ping(ip, tailcfg.PingTSMP, func(pr *ipnstate.PingResult) { if pr.Err != "" { errCh <- xerrors.New(pr.Err) return From 7933fee87f2ddbe9c0433094641cb055ad6f2f92 Mon Sep 17 00:00:00 2001 From: Spike Curtis Date: Tue, 2 Jan 2024 11:44:44 +0000 Subject: [PATCH 2/2] fix: remove connections=0 check in JetBrains tracking test Signed-off-by: Spike Curtis --- agent/agent_test.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/agent/agent_test.go b/agent/agent_test.go index 9017240738bcf..1e62ddef3e1ae 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -174,10 +174,10 @@ func TestAgent_Stats_Magic(t *testing.T) { require.NoError(t, err) err = session.Shell() require.NoError(t, err) - var s *agentsdk.Stats require.Eventuallyf(t, func() bool { - var ok bool - s, ok = <-stats + s, ok := <-stats + t.Logf("got stats: ok=%t, ConnectionCount=%d, RxBytes=%d, TxBytes=%d, SessionCountVSCode=%d, ConnectionMedianLatencyMS=%f", + ok, s.ConnectionCount, s.RxBytes, s.TxBytes, s.SessionCountVSCode, s.ConnectionMedianLatencyMS) return ok && s.ConnectionCount > 0 && s.RxBytes > 0 && s.TxBytes > 0 && // Ensure that the connection didn't count as a "normal" SSH session. // This was a special one, so it should be labeled specially in the stats! @@ -186,7 +186,7 @@ func TestAgent_Stats_Magic(t *testing.T) { // If it isn't, it's set to -1. s.ConnectionMedianLatencyMS >= 0 }, testutil.WaitLong, testutil.IntervalFast, - "never saw stats: %+v", s, + "never saw stats", ) // The shell will automatically exit if there is no stdin! _ = stdin.Close() @@ -240,14 +240,14 @@ func TestAgent_Stats_Magic(t *testing.T) { _ = tunneledConn.Close() }) - var s *agentsdk.Stats require.Eventuallyf(t, func() bool { - var ok bool - s, ok = <-stats + s, ok := <-stats + t.Logf("got stats with conn open: ok=%t, ConnectionCount=%d, SessionCountJetBrains=%d", + ok, s.ConnectionCount, s.SessionCountJetBrains) return ok && s.ConnectionCount > 0 && s.SessionCountJetBrains == 1 }, testutil.WaitLong, testutil.IntervalFast, - "never saw stats with conn open: %+v", s, + "never saw stats with conn open", ) // Kill the server and connection after checking for the echo. @@ -256,12 +256,13 @@ func TestAgent_Stats_Magic(t *testing.T) { _ = tunneledConn.Close() require.Eventuallyf(t, func() bool { - var ok bool - s, ok = <-stats - return ok && s.ConnectionCount == 0 && + s, ok := <-stats + t.Logf("got stats after disconnect %t, %d", + ok, s.SessionCountJetBrains) + return ok && s.SessionCountJetBrains == 0 }, testutil.WaitLong, testutil.IntervalFast, - "never saw stats after conn closes: %+v", s, + "never saw stats after conn closes", ) }) } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy