Skip to content

Commit

Permalink
Add explicit DNS timeout
Browse files Browse the repository at this point in the history
This makes DNS timeouts occur much more quickly and avoid clients with nonfunctional reverse DNS timing out while waiting for a response to their EHLO requests.
  • Loading branch information
GrexAut authored Aug 17, 2022
1 parent 9f0697f commit 6bace2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/postal/smtp_server/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def log(text)
private

def resolve_hostname
@hostname = Resolv.new.getname(@ip_address) rescue @ip_address
Resolv::DNS.open do |dns|
dns.timeouts = [10,5]
@hostname = dns.getname(@ip_address) rescue @ip_address
end
end

def proxy(data)
Expand Down

0 comments on commit 6bace2c

Please sign in to comment.