This commit is contained in:
crusader 2018-09-12 15:55:27 +09:00
parent b17e4af815
commit 6653ea4a87

View File

@ -2,7 +2,6 @@ package pcap
import ( import (
"fmt" "fmt"
"log"
"sort" "sort"
"sync" "sync"
@ -200,18 +199,14 @@ 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 && len(chs) > 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:]...)
} }
} }
func (ps *pCapScan) OpenUDP(ip string) chan gopacket.Packet { func (ps *pCapScan) OpenUDP(ip string) chan gopacket.Packet {