Skip to content

Commit e45da16

Browse files
ashmckenzieArchish27
authored andcommitted
Merge branch '765-lint-connection' into 'main'
Added inspecting result in connection Closes #765 See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/1136 Merged-by: Ash McKenzie <[email protected]> Approved-by: Gavin Hinfey <[email protected]> Approved-by: Javiera Tapia <[email protected]> Approved-by: Ash McKenzie <[email protected]> Co-authored-by: Archish <[email protected]>
2 parents c2d73ce + eb0ebb7 commit e45da16

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

internal/sshd/connection.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ func (c *connection) sendKeepAliveMsg(ctx context.Context, sconn *ssh.ServerConn
168168
case <-ticker.C:
169169
ctxlog.Debug("connection: sendKeepAliveMsg: send keepalive message to a client")
170170

171-
_, _, _ = sconn.SendRequest(KeepAliveMsg, true, nil)
171+
status, payload, err := sconn.SendRequest(KeepAliveMsg, true, nil)
172+
if err != nil {
173+
ctxlog.Errorf("Error occurred while sending request :%v", err)
174+
return
175+
}
176+
177+
if status {
178+
ctxlog.Debugf("connection: sendKeepAliveMsg: payload: %v", string(payload))
179+
}
172180
}
173181
}
174182
}

internal/sshd/connection_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (f *fakeConn) SendRequest(name string, _ bool, _ []byte) (bool, []byte, err
7878

7979
f.sentRequestName = name
8080

81-
return true, nil, nil
81+
return true, []byte("I am a response"), nil
8282
}
8383

8484
func setup(newChannel *fakeNewChannel) (*connection, chan ssh.NewChannel) {

0 commit comments

Comments
 (0)