本站源代码
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.

31 lines
705B

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