[PATCH 7 of 7] cmdserver: add service that listens on unix domain socket and forks process

Idan Kamara idankk86 at gmail.com
Sun Oct 5 14:23:29 CDT 2014


On Sun, Oct 5, 2014 at 7:06 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> On Sat, 4 Oct 2014 12:40:03 -0700, Idan Kamara wrote:
>> On Sat, Oct 4, 2014 at 3:52 AM, Yuya Nishihara <yuya at tcha.org> wrote:
>> > # HG changeset patch
>> > # User Yuya Nishihara <yuya at tcha.org>
>> > # Date 1412408810 -32400
>> > #      Sat Oct 04 16:46:50 2014 +0900
>> > # Node ID 9b04af3305559a96ee310e9ba6766de1c4ffa63a
>> > # Parent  0368d1677c97ad896468ab123b05760f9e34591a
>> > cmdserver: add service that listens on unix domain socket and forks process
>> >
>> > Typical use case of 'unix' mode is a background hg daemon.
>> >
>> >     $ hg serve --cmdserver unix --cwd / -a /tmp/hg-`id -u`.sock
>> >
>> > Unlike 'pipe' mode in which parent process keeps stdio channel, 'unix' server
>> > can be detached.  So clients can freely connect and disconnect from server,
>> > saving Python start-up time.
>>
>> Very nice, happy to see you moving this from chg into core!
>
> Actually this is a complete rewrite. chg had a prefork server that was more
> complicated than this patch.
>
> BTW, tip of chg can connect to a server of this patch:
>
>   $ hg serve --cmdserver unix -a /tmp/test.sock
>   $ CHGDEBUG=1 CHGSOCKNAME=/tmp/test.sock chg id
>
>> It would be nice one day to also support TCP sockets so we
>> have complete platform independence.
>
> TCP has no permission check, so it will need something like .Xauthority.
> Another big issue on Windows is fork().

Maybe binding to 127.0.0.1 is enough as a start.

I assume plain hg serve works in Windows, so why is fork needed?


More information about the Mercurial-devel mailing list