mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-15 08:30:36 +03:00
logging: More information about why connections get dropped
Fixes #197 for now, maybe more later.
This commit is contained in:
parent
cfa86b3e2e
commit
c69cefc873
@ -90,6 +90,7 @@ func NewTerminal(conn *ssh.ServerConn, ch ssh.NewChannel) (*Terminal, error) {
|
|||||||
_, err := channel.SendRequest(keepaliveRequest, true, nil)
|
_, err := channel.SendRequest(keepaliveRequest, true, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Connection is gone
|
// Connection is gone
|
||||||
|
logger.Printf("[%s] Keepalive failed, closing terminal: %s", term.Conn.RemoteAddr(), err)
|
||||||
term.Close()
|
term.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -107,6 +108,7 @@ func NewSession(conn *ssh.ServerConn, channels <-chan ssh.NewChannel) (*Terminal
|
|||||||
// Make a terminal from the first session found
|
// Make a terminal from the first session found
|
||||||
for ch := range channels {
|
for ch := range channels {
|
||||||
if t := ch.ChannelType(); t != "session" {
|
if t := ch.ChannelType(); t != "session" {
|
||||||
|
logger.Printf("[%s] Ignored channel type: %s", conn.RemoteAddr(), t)
|
||||||
ch.Reject(ssh.UnknownChannelType, fmt.Sprintf("unknown channel type: %s", t))
|
ch.Reject(ssh.UnknownChannelType, fmt.Sprintf("unknown channel type: %s", t))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user