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

123456789101112131415161718192021
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. // This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
  4. //go:build windows
  5. package graceful
  6. import "net"
  7. // DefaultGetListener obtains a listener for the local network address.
  8. // On windows this is basically just a shim around net.Listen. This function
  9. // can be replaced by changing the GetListener variable at the top of this file,
  10. // for example to listen on an onion service using github.com/cretz/bine
  11. func DefaultGetListener(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. }