Thanks to visit codestin.com
Credit goes to github.com

Skip to content

📚 Doc improvements for open_timeout, etc #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions lib/net/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,11 @@ class IMAP < Protocol
def self.config; Config.global end

# Returns the global debug mode.
# Delegates to {Net::IMAP.config.debug}[rdoc-ref:Config#debug].
def self.debug; config.debug end

# Sets the global debug mode.
# Delegates to {Net::IMAP.config.debug=}[rdoc-ref:Config#debug=].
def self.debug=(val)
config.debug = val
end
Expand All @@ -830,7 +832,7 @@ class << self
alias default_ssl_port default_tls_port
end

# Returns the initial greeting the server, an UntaggedResponse.
# Returns the initial greeting sent by the server, an UntaggedResponse.
attr_reader :greeting

# The client configuration. See Net::IMAP::Config.
Expand All @@ -839,13 +841,20 @@ class << self
# Net::IMAP.config.
attr_reader :config

# Seconds to wait until a connection is opened.
# If the IMAP object cannot open a connection within this time,
# it raises a Net::OpenTimeout exception. The default value is 30 seconds.
def open_timeout; config.open_timeout end
##
# :attr_reader: open_timeout
# Seconds to wait until a connection is opened. Also used by #starttls.
# Delegates to {config.open_timeout}[rdoc-ref:Config#open_timeout].

##
# :attr_reader: idle_response_timeout
# Seconds to wait until an IDLE response is received.
def idle_response_timeout; config.idle_response_timeout end
# Delegates to {config.idle_response_timeout}[rdoc-ref:Config#idle_response_timeout].

# :stopdoc:
def open_timeout; config.open_timeout end
def idle_response_timeout; config.idle_response_timeout end
# :startdoc:

# The hostname this client connected to
attr_reader :host
Expand Down Expand Up @@ -1332,6 +1341,10 @@ def logout!
# both successful. Any error indicates that the connection has not been
# secured.
#
# After the server agrees to start a TLS connection, this method waits up to
# {config.open_timeout}[rdoc-ref:Config#open_timeout] before raising
# +Net::OpenTimeout+.
#
# *Note:*
# >>>
# Any #response_handlers added before STARTTLS should be aware that the
Expand Down
5 changes: 4 additions & 1 deletion lib/net/imap/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,13 @@ def self.[](config)

# Seconds to wait until a connection is opened.
#
# Applied separately for establishing TCP connection and starting a TLS
# connection.
#
# If the IMAP object cannot open a connection within this time,
# it raises a Net::OpenTimeout exception.
#
# See Net::IMAP.new.
# See Net::IMAP.new and Net::IMAP#starttls.
#
# The default value is +30+ seconds.
attr_accessor :open_timeout, type: Integer
Expand Down