Skip to content

Commit

Permalink
Merge pull request #4 from Issif/memory_leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Issif authored Jun 10, 2020
2 parents c6c43b8 + 6c617f0 commit 79ad191
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,18 @@ func IsMatchingCert(config *Configuration, result *Result, reg *regexp.Regexp) b

// LoopCertStream gathers messages from CertStream
func LoopCertStream(config *Configuration) {
dial := ws.Dialer{
ReadBufferSize: 8192,
WriteBufferSize: 512,
Timeout: 1 * time.Second,
}
for {
conn, _, _, err := ws.DefaultDialer.Dial(context.Background(), certInput)
defer conn.Close()
// conn, _, _, err := ws.DefaultDialer.Dial(context.Background(), certInput)
conn, _, _, err := dial.Dial(context.Background(), certInput)
if err != nil {
log.Warn("Error connecting to CertStream! Sleeping a few seconds and reconnecting...")
time.Sleep(1 * time.Second)
conn.Close()
continue
}
for {
Expand All @@ -155,6 +161,7 @@ func LoopCertStream(config *Configuration) {
}
config.Messages <- msg
}
conn.Close()
}
}

Expand Down

0 comments on commit 79ad191

Please sign in to comment.