mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
refact: refactored module status checks in Configure methods for consistency
This commit is contained in:
parent
a8e6b497a3
commit
1e7d99433e
13 changed files with 52 additions and 53 deletions
|
@ -125,7 +125,9 @@ func (s *Sniffer) onPacketMatched(pkt gopacket.Packet) {
|
|||
func (s *Sniffer) Configure() error {
|
||||
var err error
|
||||
|
||||
if err, s.Ctx = s.GetContext(); err != nil {
|
||||
if s.Running() == true {
|
||||
return session.ErrAlreadyStarted
|
||||
} else if err, s.Ctx = s.GetContext(); err != nil {
|
||||
if s.Ctx != nil {
|
||||
s.Ctx.Close()
|
||||
s.Ctx = nil
|
||||
|
@ -137,9 +139,7 @@ func (s *Sniffer) Configure() error {
|
|||
}
|
||||
|
||||
func (s *Sniffer) Start() error {
|
||||
if s.Running() == true {
|
||||
return session.ErrAlreadyStarted
|
||||
} else if err := s.Configure(); err != nil {
|
||||
if err := s.Configure(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue