all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, eller.helmut@gmail.com, 31903@debbugs.gnu.org
Subject: bug#31903: 27.0.50; Server sockets with :nowait no longer work
Date: Thu, 05 Jul 2018 20:13:14 -0400	[thread overview]
Message-ID: <87efghdxwl.fsf@gmail.com> (raw)
In-Reply-To: <83va9xk6ch.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 02 Jul 2018 18:25:18 +0300")

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

tags 31903 + patch
quit

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Noam Postavsky <npostavs@gmail.com>
>> Date: Sun, 01 Jul 2018 11:48:45 -0400
>> Cc: Lars Ingebrigtsen <larsi@gnus.org>, 31903@debbugs.gnu.org
>> 
>> Helmut Eller <eller.helmut@gmail.com> writes:
>> 
>> > I'm not sure whether :nowait is supposed to work with server sockets,
>> > but this used to work in Emacs 25.  Either way, the error message looks
>> > pretty wrong.
>> 
>> As far as I can tell, Emacs 25 just ignores :nowait when :server is
>> passed.  We could change Emacs 26 do that as well, or we just make the
>> error official but give a more a sensible error message when passed both
>> :nowait and :server.
>
> Unless someone protests within the next few days, I think I prefer the
> latter alternative.

Okay, here is the patch for that, I will push to emacs-26 in a few days.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2747 bytes --]

From a2ec0e58ab979b0a64a097ff0880cb7509d8aced Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 5 Jul 2018 19:37:28 -0400
Subject: [PATCH v1] Explicitly reject :server and :nowait (Bug#31903)

* src/process.c (Fmake_network_process): Explicitly check for and
signal an error when passed both :server and :nowait non-nil.  In
Emacs 25, :nowait would be ignored in this case, but as of Emacs 26.1
this gives an error, albeit an unclear one.  Also remove obsolete
comment regarding configurations lacking non-blocking mode, the
corresponding code was removed in 2012-11-17 "Assume POSIX 1003.1-1988
or later for fcntl.h."
---
 src/process.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/process.c b/src/process.c
index 7f6ea1261e..4d7a735652 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3890,12 +3890,15 @@ failed) connections may be logged in the server process's buffer.
   filter = Fplist_get (contact, QCfilter);
   sentinel = Fplist_get (contact, QCsentinel);
   use_external_socket_p = Fplist_get (contact, QCuse_external_socket);
+  Lisp_Object server = Fplist_get (contact, QCserver);
+  bool nowait = !NILP (Fplist_get (contact, QCnowait));
 
+  if (!NILP (server) && nowait)
+    error ("`:server' is incompatible with `:nowait'");
   CHECK_STRING (name);
 
   /* :local ADDRESS or :remote ADDRESS */
-  tem = Fplist_get (contact, QCserver);
-  if (NILP (tem))
+  if (!NILP (server))
     address = Fplist_get (contact, QCremote);
   else
     address = Fplist_get (contact, QClocal);
@@ -4009,7 +4012,7 @@ failed) connections may be logged in the server process's buffer.
     }
 
 #ifdef HAVE_GETADDRINFO_A
-  if (!NILP (host) && !NILP (Fplist_get (contact, QCnowait)))
+  if (!NILP (host) && nowait)
     {
       ptrdiff_t hostlen = SBYTES (host);
       struct req
@@ -4154,20 +4157,13 @@ failed) connections may be logged in the server process's buffer.
 
   set_network_socket_coding_system (proc, host, service, name);
 
-  /* :server BOOL */
-  tem = Fplist_get (contact, QCserver);
-  if (!NILP (tem))
-    {
-      /* Don't support network sockets when non-blocking mode is
-	 not available, since a blocked Emacs is not useful.  */
-      p->is_server = true;
-      if (TYPE_RANGED_INTEGERP (int, tem))
-	p->backlog = XINT (tem);
-    }
+  /* :server QLEN */
+  p->is_server = !NILP (server);
+  if (TYPE_RANGED_INTEGERP (int, server))
+    p->backlog = XINT (server);
 
   /* :nowait BOOL */
-  if (!p->is_server && socktype != SOCK_DGRAM
-      && !NILP (Fplist_get (contact, QCnowait)))
+  if (!p->is_server && socktype != SOCK_DGRAM && nowait)
     p->is_non_blocking_client = true;
 
   bool postpone_connection = false;
-- 
2.11.0


  reply	other threads:[~2018-07-06  0:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 18:00 bug#31903: 27.0.50; Server sockets with :nowait no longer work Helmut Eller
2018-07-01 15:48 ` Noam Postavsky
2018-07-02 15:25   ` Eli Zaretskii
2018-07-06  0:13     ` Noam Postavsky [this message]
2018-07-10  0:46       ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efghdxwl.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=31903@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.