Skip to content

Commit

Permalink
Implement Close method for session (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhamRasal authored May 27, 2023
1 parent acde91c commit 0a25894
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions v2/pkg/passive/passive.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (a *Agent) EnumerateSubdomainsWithCtx(ctx context.Context, domain string, p
}
return
}
defer session.Close()

ctx, cancel := context.WithTimeout(ctx, maxEnumTime)

Expand Down
6 changes: 6 additions & 0 deletions v2/pkg/subscraping/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ func (s *Session) DiscardHTTPResponse(response *http.Response) {
}
}

// Close the session
func (s *Session) Close() {
s.RateLimiter.Stop()
s.Client.CloseIdleConnections()
}

func httpRequestWrapper(client *http.Client, request *http.Request) (*http.Response, error) {
response, err := client.Do(request)
if err != nil {
Expand Down

0 comments on commit 0a25894

Please sign in to comment.