mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Close TCP listeneer on port mapper
This commit is contained in:
parent
877af6dad9
commit
4afb0ecc51
1 changed files with 4 additions and 3 deletions
|
|
@ -80,6 +80,7 @@ func (pm *globalPortMapper) allocate() {
|
|||
})
|
||||
if err != nil {
|
||||
fmt.Printf("UDP port %v was available on tcp but not udp: %v\n", port, err)
|
||||
lsn.Close()
|
||||
} else {
|
||||
_ = udpConn.Close()
|
||||
if lsn == nil {
|
||||
|
|
@ -96,10 +97,9 @@ func (pm *globalPortMapper) allocateAtTop() {
|
|||
println("888888 allocateAtTop ports called")
|
||||
pm.availPorts = make([]net.Listener, pm.numPorts)
|
||||
i := 0
|
||||
next := 65000
|
||||
for i < pm.numPorts {
|
||||
|
||||
for next := 65000; i < pm.numPorts && next > 0; next-- {
|
||||
lsn, err := net.Listen("tcp", fmt.Sprintf(":%d", next))
|
||||
next--
|
||||
if err != nil {
|
||||
//fmt.Printf("next=%v, err = %v\n", next+1, err)
|
||||
continue
|
||||
|
|
@ -115,6 +115,7 @@ func (pm *globalPortMapper) allocateAtTop() {
|
|||
})
|
||||
if err != nil {
|
||||
fmt.Printf("UDP port %v was available on tcp but not udp: %v\n", port, err)
|
||||
lsn.Close()
|
||||
} else {
|
||||
_ = udpConn.Close()
|
||||
if lsn == nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue