Remove debug lines from relay

This commit is contained in:
Zoltán Papp
2026-06-25 13:56:28 +02:00
parent b5d2f054c2
commit fa91c119c3
+6 -14
View File
@@ -196,11 +196,6 @@ type Client struct {
// Transport returns the negotiated relay transport of the current connection, // Transport returns the negotiated relay transport of the current connection,
// or an empty string when not connected. // or an empty string when not connected.
func (c *Client) Transport() string { func (c *Client) Transport() string {
c.log.Warnf("start to call Transport")
defer func() {
c.log.Warnf("end of call Transport")
}()
c.log.Warnf("query Transport:")
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
return c.transport return c.transport
@@ -248,8 +243,9 @@ func NewClientWithServerIP(serverURL string, serverIP netip.Addr, authTokenStore
// Connect establishes a connection to the relay server. It blocks until the connection is established or an error occurs. // Connect establishes a connection to the relay server. It blocks until the connection is established or an error occurs.
func (c *Client) Connect(ctx context.Context) error { func (c *Client) Connect(ctx context.Context) error {
c.log.Infof("connecting to relay server") start := time.Now()
defer c.log.Warnf("end of call Connect to relay server") defer c.log.Infof("connect elapsed time: %v", time.Since(start))
c.readLoopMutex.Lock() c.readLoopMutex.Lock()
defer c.readLoopMutex.Unlock() defer c.readLoopMutex.Unlock()
@@ -292,8 +288,9 @@ func (c *Client) Connect(ctx context.Context) error {
// todo: what should happen if call with the same peerID with multiple times? // todo: what should happen if call with the same peerID with multiple times?
func (c *Client) OpenConn(ctx context.Context, dstPeerID string) (net.Conn, error) { func (c *Client) OpenConn(ctx context.Context, dstPeerID string) (net.Conn, error) {
peerID := messages.HashID(dstPeerID) peerID := messages.HashID(dstPeerID)
c.log.Infof("open conn to peer: %v", dstPeerID)
defer c.log.Warnf("end of OpenConn to peer: %v", dstPeerID) start := time.Now()
defer c.log.Infof("connect elapsed time: %v", time.Since(start))
c.mu.Lock() c.mu.Lock()
if !c.serviceIsRunning { if !c.serviceIsRunning {
@@ -362,9 +359,6 @@ func (c *Client) ServerInstanceURL() (string, error) {
// extracted from the underlying socket's RemoteAddr. Zero value if not // extracted from the underlying socket's RemoteAddr. Zero value if not
// connected or if the address is not an IP literal. // connected or if the address is not an IP literal.
func (c *Client) ConnectedIP() netip.Addr { func (c *Client) ConnectedIP() netip.Addr {
c.log.Infof("run ConnectedIP")
defer c.log.Warnf("end of Connected IP")
c.mu.Lock() c.mu.Lock()
conn := c.relayConn conn := c.relayConn
c.mu.Unlock() c.mu.Unlock()
@@ -387,8 +381,6 @@ func (c *Client) SetOnDisconnectListener(fn func(string)) {
// HasConns returns true if there are connections. // HasConns returns true if there are connections.
func (c *Client) HasConns() bool { func (c *Client) HasConns() bool {
c.log.Infof("run HasConns")
defer c.log.Warnf("end of HasConns")
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
return len(c.conns) > 0 return len(c.conns) > 0