ing
This commit is contained in:
parent
4e2fbd8960
commit
b17e4af815
|
@ -2,6 +2,7 @@ package pcap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -199,12 +200,15 @@ func (ps *pCapScan) CloseTCP(ip string, ch chan *layers.TCP) {
|
||||||
}
|
}
|
||||||
|
|
||||||
chs := ps.tcpListenerChans[ip]
|
chs := ps.tcpListenerChans[ip]
|
||||||
|
log.Print("len1 ", len(chs))
|
||||||
i := sort.Search(len(chs), func(i int) bool {
|
i := sort.Search(len(chs), func(i int) bool {
|
||||||
return ch == chs[i]
|
return ch == chs[i]
|
||||||
})
|
})
|
||||||
|
log.Print("len2 ", len(chs))
|
||||||
|
|
||||||
if -1 != i {
|
if -1 != i && len(chs) > i {
|
||||||
close(ch)
|
close(ch)
|
||||||
|
log.Print("len3 ", len(chs), " i ", i)
|
||||||
ps.tcpListenerChans[ip] = append(ps.tcpListenerChans[ip][:i], ps.tcpListenerChans[ip][i+1:]...)
|
ps.tcpListenerChans[ip] = append(ps.tcpListenerChans[ip][:i], ps.tcpListenerChans[ip][i+1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user