THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

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.

web_graceful.go 1.0KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2016 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 cmd
  5. import (
  6. "crypto/tls"
  7. "net/http"
  8. "code.gitea.io/gitea/modules/graceful"
  9. )
  10. func runHTTP(listenAddr string, m http.Handler) error {
  11. return graceful.HTTPListenAndServe("tcp", listenAddr, m)
  12. }
  13. func runHTTPS(listenAddr, certFile, keyFile string, m http.Handler) error {
  14. return graceful.HTTPListenAndServeTLS("tcp", listenAddr, certFile, keyFile, m)
  15. }
  16. func runHTTPSWithTLSConfig(listenAddr string, tlsConfig *tls.Config, m http.Handler) error {
  17. return graceful.HTTPListenAndServeTLSConfig("tcp", listenAddr, tlsConfig, m)
  18. }
  19. // NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
  20. func NoHTTPRedirector() {
  21. graceful.Manager.InformCleanup()
  22. }
  23. // NoMainListener tells our cleanup routine that we will not be using a possibly provided listener
  24. // for our main HTTP/HTTPS service
  25. func NoMainListener() {
  26. graceful.Manager.InformCleanup()
  27. }