Skip to content

Commit

Permalink
session status and duration displaying properly
Browse files Browse the repository at this point in the history
  • Loading branch information
valentin.daviot authored and moul committed Nov 16, 2018
1 parent d6be01b commit e860b60
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@ func channelHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewCh
if err != nil {
log.Printf("Error: %v", err)
}
}()

now := time.Now()
sessUpdate := Session{
Status: SessionStatusClosed,
ErrMsg: fmt.Sprintf("%v", err),
StoppedAt: &now,
}
switch sessUpdate.ErrMsg {
case "lch closed the connection", "rch closed the connection":
sessUpdate.ErrMsg = ""
}
actx.db.Model(&sess).Updates(&sessUpdate)
now := time.Now()
sessUpdate := Session{
Status: SessionStatusClosed,
ErrMsg: fmt.Sprintf("%v", err),
StoppedAt: &now,
}
switch sessUpdate.ErrMsg {
case "lch closed the connection", "rch closed the connection":
sessUpdate.ErrMsg = ""
}
actx.db.Model(&sess).Updates(&sessUpdate)
}()
case BastionSchemeTelnet:
tmpSrv := ssh.Server{
// PtyCallback: srv.PtyCallback,
Expand Down

0 comments on commit e860b60

Please sign in to comment.