1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Only do async DNS if requested with :nowait 'dns

* doc/lispref/processes.texi (Network Processes): Mention the
dns value of :nowait.

* src/process.c (Fmake_network_process): Only do async DNS if
:nowait is `dns'.
This commit is contained in:
Lars Ingebrigtsen 2016-02-05 13:57:28 +11:00
parent e4c58cf3fe
commit c85e7d4c8c
3 changed files with 27 additions and 11 deletions

View file

@ -2409,8 +2409,8 @@ as it may depend on implementation defined constants, data sizes, and
data structure alignment.
@end itemize
@item :nowait @var{bool}
If @var{bool} is non-@code{nil} for a stream connection, return
@item :nowait @var{nowait}
If @var{nowait} is non-@code{nil} for a stream connection, return
without waiting for the connection to complete. When the connection
succeeds or fails, Emacs will call the sentinel function, with a
second argument matching @code{"open"} (if successful) or
@ -2418,6 +2418,12 @@ second argument matching @code{"open"} (if successful) or
@code{make-network-process} does not return until the connection
has succeeded or failed.
If @var{nowait} is @code{dns}, also do the @acronym{DNS} lookup
asynchronously, if supported. In that case, the process is returned
before a connection has been made, and the client should not try
communicating with the process until it has changed status to
@code{"connected"}.
@item :tls-parameters
When opening a TLS connection, this should be where the first element
is the TLS type (which should either be @code{gnutls-x509pki} or

View file

@ -136,8 +136,12 @@ non-nil, is used warn the user if the connection isn't encrypted.
:nogreeting is a boolean that can be used to inhibit waiting for
a greeting from the server.
:nowait is a boolean that says the connection should be made
asynchronously, if possible.
:nowait, if non-nil, says the connection should be made
asynchronously, if possible. If it is `dns', also do the DNS
lookup asynchronously, if supported. In that case, the process
is returned before a connection has been made, and the client
should not try communicating with the process until it has
changed status to \"connected\".
:tls-parameters is a list that should be supplied if you're
opening a TLS connection. The first element is the TLS

View file

@ -3421,11 +3421,16 @@ system used for both reading and writing for this process. If CODING
is a cons (DECODING . ENCODING), DECODING is used for reading, and
ENCODING is used for writing.
:nowait BOOL -- If BOOL is non-nil for a stream type client process,
return without waiting for the connection to complete; instead, the
sentinel function will be called with second arg matching "open" (if
successful) or "failed" when the connect completes. Default is to use
a blocking connect (i.e. wait) for stream type connections.
:nowait NOWAIT -- If NOWAIT is non-nil for a stream type client
process, return without waiting for the connection to complete;
instead, the sentinel function will be called with second arg matching
"open" (if successful) or "failed" when the connect completes.
Default is to use a blocking connect (i.e. wait) for stream type
connections. If NOWAIT is `dns', also do the DNS lookup
asynchronously, if supported. In that case, the process is returned
before a connection has been made, and the client should not try
communicating with the process until it has changed status to
"connected".
:noquery BOOL -- Query the user unless BOOL is non-nil, and process is
running when Emacs is exited.
@ -3688,7 +3693,7 @@ usage: (make-network-process &rest ARGS) */)
#endif
#ifdef HAVE_GETADDRINFO_A
if (!NILP (Fplist_get (contact, QCnowait)) &&
if (EQ (Fplist_get (contact, QCnowait), Qdns) &&
!NILP (host))
{
int ret;
@ -4603,7 +4608,7 @@ check_for_dns (Lisp_Object proc)
return Qnil;
/* This process should not already be connected (or killed). */
if (p->infd != 0)
if (!EQ (p->status, Qconnect))
return Qnil;
ret = gai_error (p->dns_requests[0]);
@ -7752,6 +7757,7 @@ syms_of_process (void)
DEFSYM (QCcoding, ":coding");
DEFSYM (QCserver, ":server");
DEFSYM (QCnowait, ":nowait");
DEFSYM (Qdns, "dns");
DEFSYM (QCsentinel, ":sentinel");
DEFSYM (QCtls_parameters, ":tls-parameters");
DEFSYM (QClog, ":log");