Yuya Nishihara  committed e9b349d

thgbackdoor: drop implementation of unix domain socket (QLocalServer)

  • Participants
  • Parent commits 6e8ef12

Comments (0)

Files changed (2)

File hgext/

 process. This extension might be usable for automated test.
 To start the backdoor server, you must specify the server address by
-`THGBACKDOOR` environment variable. It must be a local socket name without
-/tmp, or tcp address:port.
+`THGBACKDOOR` environment variable. It must be a tcp address:port.
-    % THGBACKDOOR=thgbackdoor-`id -u`.sock thg --nofork -v
-    thgbackdoor: listening at /tmp/thgbackdoor-1000.sock
     % THGBACKDOOR=localhost:12345 thg --nofork -v
     thgbackdoor: listening at
 import os, traceback
 from PyQt4.QtCore import QByteArray, QCoreApplication, QObject, QTimer
 from PyQt4.QtCore import Qt, pyqtSignal, pyqtSlot
-from PyQt4.QtNetwork import QHostAddress, QLocalServer, QTcpServer
+from PyQt4.QtNetwork import QHostAddress, QTcpServer
 from mercurial import demandimport
 class BackDoorServer(QObject):
-    """Manages TCP/Local server and established session"""
+    """Manages TCP server and established session"""
     _excinfogot = pyqtSignal(object, object, object)
     def __init__(self, ui, parent=None):
         """Start listening at the specified address"""
         if self._sock:
             raise ValueError('already listening')
-        if ':' in address:
-            self._setuptcpserver(address)
-        elif address:
-            self._setuplocalserver(address)
-    def _setuptcpserver(self, address):
         host, port = address.split(':', 1)
         if host == 'localhost':
             host = ''
         port = int(port)
+        # Why not unix domain socket? Because Windows never support it.
         self._sock = sock = QTcpServer(self)
         if sock.listen(QHostAddress(host), port):
             self._ui.warn('thgbackdoor: failed to listen at %s:%d\n'
                           % (host, port))
-    def _setuplocalserver(self, address):
-        QLocalServer.removeServer(address)
-        self._sock = sock = QLocalServer(self)
-        sock.newConnection.connect(self._handleconnection)
-        if sock.listen(address):
-            self._ui.note('thgbackdoor: listening at %s\n'
-                          % sock.fullServerName())
-        else:
-            self._ui.warn('thgbackdoor: failed to listen at %s\n' % address)
     def _handleconnection(self):
         while self._sock.hasPendingConnections():

File tests/

     def test_raise_delayed_exception(self):
         self.thg.exec_('QTimer.singleShot(0, lambda: _unknown_attribute)')
         self.assertRaises(RemoteError, lambda: self.thg.wait())
-# TODO: test unix domain socket?