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

View File

@@ -196,11 +196,6 @@ type Client struct {
// Transport returns the negotiated relay transport of the current connection,
// or an empty string when not connected.
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()
defer c.mu.Unlock()
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.
func (c *Client) Connect(ctx context.Context) error {
c.log.Infof("connecting to relay server")
defer c.log.Warnf("end of call Connect to relay server")
start := time.Now()
defer c.log.Infof("connect elapsed time: %v", time.Since(start))
c.readLoopMutex.Lock()
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?
func (c *Client) OpenConn(ctx context.Context, dstPeerID string) (net.Conn, error) {
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()
if !c.serviceIsRunning {
@@ -362,9 +359,6 @@ func (c *Client) ServerInstanceURL() (string, error) {
// extracted from the underlying socket's RemoteAddr. Zero value if not
// connected or if the address is not an IP literal.
func (c *Client) ConnectedIP() netip.Addr {
c.log.Infof("run ConnectedIP")
defer c.log.Warnf("end of Connected IP")
c.mu.Lock()
conn := c.relayConn
c.mu.Unlock()
@@ -387,8 +381,6 @@ func (c *Client) SetOnDisconnectListener(fn func(string)) {
// HasConns returns true if there are connections.
func (c *Client) HasConns() bool {
c.log.Infof("run HasConns")
defer c.log.Warnf("end of HasConns")
c.mu.Lock()
defer c.mu.Unlock()
return len(c.conns) > 0