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 631B

12345678910111213141516171819
  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. package graceful
  7. import "net"
  8. // GetListener obtains a listener for the local network address.
  9. // On windows this is basically just a shim around net.Listen.
  10. func GetListener(network, address string) (net.Listener, error) {
  11. // Add a deferral to say that we've tried to grab a listener
  12. defer GetManager().InformCleanup()
  13. return net.Listen(network, address)
  14. }