summaryrefslogtreecommitdiff
path: root/internal/clients
diff options
context:
space:
mode:
Diffstat (limited to 'internal/clients')
-rw-r--r--internal/clients/remote/connection.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/internal/clients/remote/connection.go b/internal/clients/remote/connection.go
index 5941115..2d97d14 100644
--- a/internal/clients/remote/connection.go
+++ b/internal/clients/remote/connection.go
@@ -93,31 +93,31 @@ func (c *Connection) initServerPort(server string) {
// Start the server connection. Build up SSH session and send some DTail commands.
func (c *Connection) Start(ctx context.Context, cancel context.CancelFunc, throttleCh, statsCh chan struct{}) {
// Throttle how many connections can be established concurrently (based on ch length)
- logger.Debug("Throttling connection", len(throttleCh), cap(throttleCh))
+ logger.Debug(c.Server, "Throttling connection", len(throttleCh), cap(throttleCh))
select {
case throttleCh <- struct{}{}:
case <-ctx.Done():
- logger.Debug("Not establishing connection as context is done", len(throttleCh), cap(throttleCh), c.Server)
+ logger.Debug(c.Server, "Not establishing connection as context is done", len(throttleCh), cap(throttleCh))
return
}
- logger.Debug("Throttling says that the connection can be established", len(throttleCh), cap(throttleCh), c.Server)
+ logger.Debug(c.Server, "Throttling says that the connection can be established", len(throttleCh), cap(throttleCh))
go func() {
defer func() {
if !c.throttlingDone {
- logger.Debug("Unthrottling connection (1)", len(throttleCh), cap(throttleCh), c.Server)
+ logger.Debug(c.Server, "Unthrottling connection (1)", len(throttleCh), cap(throttleCh))
c.throttlingDone = true
<-throttleCh
}
cancel()
}()
- if err := c.dial(ctx, cancel, c.Server, c.port, throttleCh, statsCh); err != nil {
+ if err := c.dial(ctx, cancel, throttleCh, statsCh); err != nil {
logger.Warn(c.Server, c.port, err)
if c.hostKeyCallback.Untrusted(fmt.Sprintf("%s:%d", c.Server, c.port)) {
- logger.Debug("Not trusting host", c.Server, c.port)
+ logger.Debug(c.Server, "Not trusting host")
}
}
}()
@@ -126,16 +126,16 @@ func (c *Connection) Start(ctx context.Context, cancel context.CancelFunc, throt
}
// Dail into a new SSH connection. Close connection in case of an error.
-func (c *Connection) dial(ctx context.Context, cancel context.CancelFunc, host string, port int, throttleCh, statsCh chan struct{}) error {
- logger.Debug("Incrementing connection stats", host)
+func (c *Connection) dial(ctx context.Context, cancel context.CancelFunc, throttleCh, statsCh chan struct{}) error {
+ logger.Debug(c.Server, "Incrementing connection stats")
statsCh <- struct{}{}
defer func() {
- logger.Debug("Decrementing connection stats", host)
+ logger.Debug(c.Server, "Decrementing connection stats")
<-statsCh
}()
- logger.Debug("Dialing into the connection", host)
- address := fmt.Sprintf("%s:%d", host, port)
+ logger.Debug(c.Server, "Dialing into the connection")
+ address := fmt.Sprintf("%s:%d", c.Server, c.port)
client, err := ssh.Dial("tcp", address, c.config)
if err != nil {
@@ -201,7 +201,7 @@ func (c *Connection) handle(ctx context.Context, cancel context.CancelFunc, sess
}
if !c.throttlingDone {
- logger.Debug("Unthrottling connection (2)", len(throttleCh), cap(throttleCh), c.Server)
+ logger.Debug(c.Server, "Unthrottling connection (2)", len(throttleCh), cap(throttleCh))
c.throttlingDone = true
<-throttleCh
}