Patchwork chgserver: explicitly set blocking on client socket

login
register
mail settings
Submitter Jun Wu
Date March 9, 2016, 11:58 p.m.
Message ID <9a176f60278dd6cd43a8.1457567892@x1c>
Download mbox | patch
Permalink /patch/13731/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - March 9, 2016, 11:58 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1457567852 0
#      Wed Mar 09 23:57:32 2016 +0000
# Node ID 9a176f60278dd6cd43a8f1a3940d410da2eed731
# Parent  b0ed6e1cf51a6c44c5323a35622bea0e35fd0b0d
chgserver: explicitly set blocking on client socket

hgcia.py uses socket.setdefaulttimeout and it will make every new socket object
behave differently. This patch explicitly set client socket to be blocking
without a timeout and makes it possible for chg to pass test-hgcia.t
Yuya Nishihara - March 10, 2016, 3:50 p.m.
On Wed, 9 Mar 2016 23:58:12 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1457567852 0
> #      Wed Mar 09 23:57:32 2016 +0000
> # Node ID 9a176f60278dd6cd43a8f1a3940d410da2eed731
> # Parent  b0ed6e1cf51a6c44c5323a35622bea0e35fd0b0d
> chgserver: explicitly set blocking on client socket
> 
> hgcia.py uses socket.setdefaulttimeout and it will make every new socket object
> behave differently. This patch explicitly set client socket to be blocking
> without a timeout and makes it possible for chg to pass test-hgcia.t

The other socket operation would be suffered by this as well. Perhaps we should
fix hgcia.py instead.
Sean Farley - March 10, 2016, 7:25 p.m.
Yuya Nishihara <yuya@tcha.org> writes:

> On Wed, 9 Mar 2016 23:58:12 +0000, Jun Wu wrote:
>> # HG changeset patch
>> # User Jun Wu <quark@fb.com>
>> # Date 1457567852 0
>> #      Wed Mar 09 23:57:32 2016 +0000
>> # Node ID 9a176f60278dd6cd43a8f1a3940d410da2eed731
>> # Parent  b0ed6e1cf51a6c44c5323a35622bea0e35fd0b0d
>> chgserver: explicitly set blocking on client socket
>> 
>> hgcia.py uses socket.setdefaulttimeout and it will make every new socket object
>> behave differently. This patch explicitly set client socket to be blocking
>> without a timeout and makes it possible for chg to pass test-hgcia.t
>
> The other socket operation would be suffered by this as well. Perhaps we should
> fix hgcia.py instead.

Isn't the cia dead? Should we just drop it?
Yuya Nishihara - March 11, 2016, 2:10 p.m.
On Thu, 10 Mar 2016 11:25:58 -0800, Sean Farley wrote:
> Yuya Nishihara <yuya@tcha.org> writes:
> > On Wed, 9 Mar 2016 23:58:12 +0000, Jun Wu wrote:
> >> # HG changeset patch
> >> # User Jun Wu <quark@fb.com>
> >> # Date 1457567852 0
> >> #      Wed Mar 09 23:57:32 2016 +0000
> >> # Node ID 9a176f60278dd6cd43a8f1a3940d410da2eed731
> >> # Parent  b0ed6e1cf51a6c44c5323a35622bea0e35fd0b0d
> >> chgserver: explicitly set blocking on client socket
> >> 
> >> hgcia.py uses socket.setdefaulttimeout and it will make every new socket object
> >> behave differently. This patch explicitly set client socket to be blocking
> >> without a timeout and makes it possible for chg to pass test-hgcia.t
> >
> > The other socket operation would be suffered by this as well. Perhaps we should
> > fix hgcia.py instead.
> 
> Isn't the cia dead? Should we just drop it?

Yeah, I think we can drop it. It will be a breaking change, but it would be
broken for years.

http://cia.vc/

Patch

diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -341,6 +341,7 @@ 
         super(chgcmdserver, self).__init__(
             _newchgui(ui, channeledsystem(fin, fout, 'S')), repo, fin, fout)
         self.clientsock = sock
+        sock.setblocking(1)
         self._oldios = []  # original (self.ch, ui.fp, fd) before "attachio"
         self.hashstate = hashstate
         self.baseaddress = baseaddress