unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] emacs: Use socket instead of port.
Date: Tue, 15 Dec 2015 12:13:04 +0100	[thread overview]
Message-ID: <871tao7ynz.fsf@gnu.org> (raw)
In-Reply-To: <87oadscayu.fsf@gmail.com> (Alex Kost's message of "Tue, 15 Dec 2015 12:33:45 +0300")

Alex Kost <alezost@gmail.com> skribis:

> Hm, but it doesn't delete the socket after the quit, right?  At least,
> it doesn't when I tried "guile -l /tmp/repl-server.scm" with the
> following "/tmp/repl-server.scm":
>
>
> (use-modules (system repl server))
>
> (let ((socket "/tmp/s1"))
>   (call-with-new-thread
>    (lambda ()
>      (dynamic-wind
>        (const #t)
>        (lambda ()
>          (run-server (make-unix-domain-server-socket #:path socket)))
>        (lambda ()
>          (false-if-exception (delete-file socket)))))))
>
>
> And after ",q" the file "/tmp/s1" stayed.

Right, in that case, the thread is not properly terminated so it doesn’t
have a chance to run its dynwind handler.

Hmm, that sucks.

>> It may be good to fix it upfront though.  WDYT?
>
> Sorry, I don't understand.

I meant that we should probably fix this lingering socket problem before
committing the change.

> Anyway, as I mentioned in the reply to Florian, I think the best would
> be to add a procedure for deleting socket file to `kill-emacs-hook' (as
> in the attached updated patch).  This should prevent appearing dead
> sockets.

Indeed, sounds even better!

> P.S.  Maybe it's a wrong impression, but it looks (to me) that
> connecting to a socket is significantly faster than using a port (so all
> this Guix REPL stuff starts faster).

Hmm I don’t think it should be noticeably faster.  But it’s definitely
better because socket nodes are not a scarce/global resource (unlike TCP
ports), and they are integrated with the Unix file permission model.

> From d6903c7c115809cf88f892e78785d920ff80184d Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Sat, 12 Dec 2015 11:23:03 +0300
> Subject: [PATCH] emacs: Use socket instead of port.
>
> Suggested by Florian Paul Schmidt.
>
> * emacs/guix-backend.el (guix-default-port): Remove.
>   (guix-repl-socket-file-name-function, guix-repl-current-socket): New
>   variables.
>   (guix-repl-socket-file-name, guix-repl-delete-socket-maybe): New
>   procedures.
>   (guix-get-guile-program): Take socket as an optional argument.
>   (guix-start-repl-maybe): Adjust accordingly.

LGTM, thanks!

Ludo’.

  reply	other threads:[~2015-12-15 11:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12  8:50 [PATCH] emacs: Use socket instead of port Alex Kost
2015-12-12  9:00 ` Florian Paul Schmidt
2015-12-15  9:33   ` Alex Kost
2015-12-12 18:07 ` Ludovic Courtès
2015-12-15  9:33   ` Alex Kost
2015-12-15 11:13     ` Ludovic Courtès [this message]
2015-12-15 18:39       ` Alex Kost

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=871tao7ynz.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --cc=guix-devel@gnu.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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).