Skip to content

Commit

Permalink
opt: ipPortNumMap auto release
Browse files Browse the repository at this point in the history
  • Loading branch information
XinRoom committed Feb 6, 2023
1 parent 7bc50a7 commit d1977c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/go-portScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func run(c *cli.Context) error {
ipPortNum, ipPortNumOk = ipPortNumMap[ip.String()]
ipPortNumRW.RUnlock()
if ipPortNumOk && ipPortNum >= maxOpenPort {
return
break
}
}

Expand All @@ -284,6 +284,11 @@ func run(c *cli.Context) error {
Port: _port,
})
}
if maxOpenPort > 0 {
ipPortNumRW.Lock()
delete(ipPortNumMap, ip.String())
ipPortNumRW.Unlock()
}
}

// Pool - ping and port scan
Expand Down

0 comments on commit d1977c4

Please sign in to comment.