Skip to content

Commit

Permalink
moved sigterm handler out of the library
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed May 13, 2020
1 parent 058760c commit 3a6db79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 5 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"net/url"
"os"
"os/signal"
"time"
)

Expand Down Expand Up @@ -123,4 +124,8 @@ func main() {

peng := p.New(&config)
peng.Start()
sig := make(chan os.Signal, 1024)
signal.Notify(sig, os.Interrupt)
<-sig
log.Println("Quitting Peng, bye!")
}
7 changes: 0 additions & 7 deletions peng.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
_ "github.com/google/gopacket/layers" //Used to init internal struct
"github.com/google/gopacket/pcap"
"log"
"os"
"os/signal"
"time"
)

Expand Down Expand Up @@ -71,11 +69,6 @@ func (p *Peng) Start() {
p.inspect(packet)
}
}()

sig := make(chan os.Signal, 1024)
signal.Notify(sig, os.Interrupt)
<-sig
log.Println("Quitting Peng, bye!")
}

func (p *Peng) PrintAllInfo() {
Expand Down

0 comments on commit 3a6db79

Please sign in to comment.