summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/shazow/ssh-chat/sshd/net.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-11-17 21:42:41 +0100
committerGitHub <noreply@github.com>2019-11-17 21:42:41 +0100
commitd4253d7a55f7af862304fb65c461547055dd294a (patch)
tree8a8c5ed06841ea2bd3a24639dcd5462cfdbfea32 /vendor/github.com/shazow/ssh-chat/sshd/net.go
parent0917dc876613fd71c9726a34bf0138b4f5121be9 (diff)
downloadmatterbridge-msglm-d4253d7a55f7af862304fb65c461547055dd294a.tar.gz
matterbridge-msglm-d4253d7a55f7af862304fb65c461547055dd294a.tar.bz2
matterbridge-msglm-d4253d7a55f7af862304fb65c461547055dd294a.zip
Update shazow/ssh-chat dependency (#947)
Diffstat (limited to 'vendor/github.com/shazow/ssh-chat/sshd/net.go')
-rw-r--r--vendor/github.com/shazow/ssh-chat/sshd/net.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/github.com/shazow/ssh-chat/sshd/net.go b/vendor/github.com/shazow/ssh-chat/sshd/net.go
index 1b3f4028..8305696b 100644
--- a/vendor/github.com/shazow/ssh-chat/sshd/net.go
+++ b/vendor/github.com/shazow/ssh-chat/sshd/net.go
@@ -7,7 +7,7 @@ import (
"golang.org/x/crypto/ssh"
)
-// Container for the connection and ssh-related configuration
+// SSHListener is the container for the connection and ssh-related configuration
type SSHListener struct {
net.Listener
config *ssh.ServerConfig
@@ -16,7 +16,7 @@ type SSHListener struct {
HandlerFunc func(term *Terminal)
}
-// Make an SSH listener socket
+// ListenSSH makes an SSH listener socket
func ListenSSH(laddr string, config *ssh.ServerConfig) (*SSHListener, error) {
socket, err := net.Listen("tcp", laddr)
if err != nil {
@@ -43,7 +43,7 @@ func (l *SSHListener) handleConn(conn net.Conn) (*Terminal, error) {
return NewSession(sshConn, channels)
}
-// Accept incoming connections as terminal requests and yield them
+// Serve Accepts incoming connections as terminal requests and yield them
func (l *SSHListener) Serve() {
defer l.Close()
for {
@@ -59,6 +59,7 @@ func (l *SSHListener) Serve() {
term, err := l.handleConn(conn)
if err != nil {
logger.Printf("[%s] Failed to handshake: %s", conn.RemoteAddr(), err)
+ conn.Close() // Must be closed to avoid a leak
return
}
l.HandlerFunc(term)