You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ssh_graceful.go 698B

12345678910111213141516171819202122232425262728
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package ssh
  5. import (
  6. "code.gitea.io/gitea/modules/graceful"
  7. "code.gitea.io/gitea/modules/log"
  8. "github.com/gliderlabs/ssh"
  9. )
  10. func listen(server *ssh.Server) {
  11. gracefulServer := graceful.NewServer("tcp", server.Addr)
  12. err := gracefulServer.ListenAndServe(server.Serve)
  13. if err != nil {
  14. log.Critical("Failed to start SSH server: %v", err)
  15. }
  16. log.Info("SSH Listener: %s Closed", server.Addr)
  17. }
  18. // Unused informs our cleanup routine that we will not be using a ssh port
  19. func Unused() {
  20. graceful.GetManager().InformCleanup()
  21. }