add connection count info

pull/4389/head
Elim Tsiagbey 2 years ago
parent 0658f8c12c
commit 4c9ba980f5

@ -45,7 +45,8 @@ type SessionInfo struct {
}
type ConnectionInfo struct {
ConnectionsLeft int32 `json:"connections_left"`
ConnectionsLeft int32 `json:"connections_left"`
ConnectionsCount int32 `json:"connections_count"`
}
type TerminationInfo struct {
@ -452,11 +453,12 @@ func (c *Command) Run(args []string) (retCode int) {
// done it manually
return
case connsLeft := <-connsLeftCh:
c.updateConnsLeft(connsLeft)
connectionsCount := clientProxy.ConnectionsCount()
c.updateConnsLeft(connsLeft, connectionsCount)
// If there are no available connections left and there are no connections
// we can exit
if connsLeft == 0 && clientProxy.ConnectionsCount() == 0 {
if connsLeft == 0 && connectionsCount == 0 {
return
}
}
@ -574,9 +576,10 @@ func (c *Command) printCredentials(creds []*targets.SessionCredential) error {
return nil
}
func (c *Command) updateConnsLeft(connsLeft int32) {
func (c *Command) updateConnsLeft(connsLeft int32, connsCount int32) {
connInfo := ConnectionInfo{
ConnectionsLeft: connsLeft,
ConnectionsLeft: connsLeft,
ConnectionsCount: connsCount,
}
if c.flagExec == "" {

@ -114,7 +114,8 @@ func generateConnectionInfoTableOutput(in ConnectionInfo) string {
var ret []string
nonAttributeMap := map[string]any{
"Connections Left": in.ConnectionsLeft,
"Connections Left": in.ConnectionsLeft,
"Connections Count": in.ConnectionsCount,
}
maxLength := 0

Loading…
Cancel
Save