test open too many files
This commit is contained in:
parent
3c32236374
commit
6cd7c96230
1
dip.go
1
dip.go
|
@ -87,6 +87,7 @@ func (group *DIPGroup) Choose(addr string) {
|
|||
group.Current.ActiveTime = now
|
||||
// log.Println("new set addr:", group.Current.Host, "restartAddr:", restartAddr, "resp", resp.Content())
|
||||
SetAddrForward(group.IPTableNum, addr, ip)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
switch.go
10
switch.go
|
@ -26,7 +26,7 @@ type Switch struct {
|
|||
func SetAddrForward(num, addr, ip string) {
|
||||
port := strings.Split(addr, ":")[1]
|
||||
cmd := exec.Command("/bin/sh", "-c", "sudo iptables -t nat -R IPSWITCH "+num+" -p tcp --dport "+port+" -j DNAT --to "+ip+":8885")
|
||||
err := cmd.Run()
|
||||
_, err := cmd.Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -54,14 +54,14 @@ func (swi *Switch) Run(addr string, ipregion string) {
|
|||
swi.ipregion = regexp.MustCompile(ipregion)
|
||||
|
||||
cmd := exec.Command("/bin/sh", "-c", "sudo iptables -t nat -N IPSWITCH")
|
||||
cmd.Run()
|
||||
cmd.Output()
|
||||
|
||||
cmd = exec.Command("/bin/sh", "-c", "sudo iptables -t nat -F IPSWITCH")
|
||||
cmd.Run()
|
||||
cmd.Output()
|
||||
|
||||
for range swi.Worker.ForLoop {
|
||||
cmd := exec.Command("/bin/sh", "-c", "sudo iptables -t nat -A IPSWITCH -p icmp -s 1.1.1.1 -j DNAT --to 1.1.1.1:8885")
|
||||
err := cmd.Run()
|
||||
_, err := cmd.Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ func (swi *Switch) checkInReady(ip string, now int64) {
|
|||
dipg.Group[ip].ActiveTime = now
|
||||
|
||||
if dh, ok := dipg.Waitor[ip]; ok {
|
||||
if dh.OverTime(now, 12) > 0 {
|
||||
if dh.OverTime(now, 20) > 0 {
|
||||
delete(dipg.Waitor, ip)
|
||||
} else {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user