github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/net/listener_windows.go (about)

     1  // +build windows
     2  
     3  package net
     4  
     5  import (
     6  	nt "net"
     7  	"os"
     8  	"sync"
     9  )
    10  
    11  type listener struct {
    12  	ln            nt.Listener
    13  	once          sync.Once
    14  	pconn         nt.PacketConn
    15  	lnaddr        nt.Addr
    16  	addr, network string
    17  }
    18  
    19  func (ln *listener) renormalize() error {
    20  	return nil
    21  }
    22  
    23  func (ln *listener) close() {
    24  	ln.once.Do(func() {
    25  		if ln.ln != nil {
    26  			sniffErrorAndLog(ln.ln.Close())
    27  		}
    28  		if ln.pconn != nil {
    29  			sniffErrorAndLog(ln.pconn.Close())
    30  		}
    31  		if ln.network == "unix" {
    32  			sniffErrorAndLog(os.RemoveAll(ln.addr))
    33  		}
    34  	})
    35  }