diff --git a/README.md b/README.md index 9e67eb1..4b62e0d 100644 --- a/README.md +++ b/README.md @@ -55,5 +55,3 @@ things up with `make run`. * [ ] Lots of refactoring * [ ] Pull out the chat-related stuff into isolation from the ssh serving stuff - -* Fix hanging on collision connect diff --git a/client.go b/client.go index 1d84276..2476a6d 100644 --- a/client.go +++ b/client.go @@ -88,7 +88,14 @@ func (c *Client) Rename(name string) { func (c *Client) handleShell(channel ssh.Channel) { defer channel.Close() - c.ready <- struct{}{} + + // FIXME: This shouldn't live here, need to restructure the call chaining. + c.Server.Add(c) + go func() { + // Block until done, then remove. + c.Conn.Wait() + c.Server.Remove(c) + }() go func() { for msg := range c.Msg { diff --git a/server.go b/server.go index ff835e2..c103a24 100644 --- a/server.go +++ b/server.go @@ -195,16 +195,6 @@ func (s *Server) Start(laddr string) error { client := NewClient(s, sshConn) go client.handleChannels(channels) - - // FIXME: This is hacky, need to restructure the concurrency. Fairly sure this will leak channels. - <-client.ready - s.Add(client) - - go func() { - // Block until done, then remove. - sshConn.Wait() - s.Remove(client) - }() }() } }()