code.gitea.io/gitea@v1.19.3/modules/graceful/net_windows.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  // This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
     5  
     6  //go:build windows
     7  
     8  package graceful
     9  
    10  import "net"
    11  
    12  // GetListener obtains a listener for the local network address.
    13  // On windows this is basically just a shim around net.Listen.
    14  func GetListener(network, address string) (net.Listener, error) {
    15  	// Add a deferral to say that we've tried to grab a listener
    16  	defer GetManager().InformCleanup()
    17  
    18  	return net.Listen(network, address)
    19  }