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.

net_windows.go 649B

1234567891011121314151617181920
  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. // This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
  5. //go:build windows
  6. // +build windows
  7. package graceful
  8. import "net"
  9. // GetListener obtains a listener for the local network address.
  10. // On windows this is basically just a shim around net.Listen.
  11. func GetListener(network, address string) (net.Listener, error) {
  12. // Add a deferral to say that we've tried to grab a listener
  13. defer GetManager().InformCleanup()
  14. return net.Listen(network, address)
  15. }