mercurial/chgserver.py
changeset 49286 c6a3243567b6
parent 49260 cd51d4957b28
child 50584 55886050a583
equal deleted inserted replaced
49285:34020d1f1635 49286:c6a3243567b6
   387         channels except cresult will no longer be used
   387         channels except cresult will no longer be used
   388         """
   388         """
   389         # tell client to sendmsg() with 1-byte payload, which makes it
   389         # tell client to sendmsg() with 1-byte payload, which makes it
   390         # distinctive from "attachio\n" command consumed by client.read()
   390         # distinctive from "attachio\n" command consumed by client.read()
   391         self.clientsock.sendall(struct.pack(b'>cI', b'I', 1))
   391         self.clientsock.sendall(struct.pack(b'>cI', b'I', 1))
   392         clientfds = util.recvfds(self.clientsock.fileno())
   392 
       
   393         data, ancdata, msg_flags, address = self.clientsock.recvmsg(1, 256)
       
   394         assert len(ancdata) == 1
       
   395         cmsg_level, cmsg_type, cmsg_data = ancdata[0]
       
   396         assert cmsg_level == socket.SOL_SOCKET
       
   397         assert cmsg_type == socket.SCM_RIGHTS
       
   398         # memoryview.cast() was added in typeshed 61600d68772a, but pytype
       
   399         # still complains
       
   400         # pytype: disable=attribute-error
       
   401         clientfds = memoryview(cmsg_data).cast('i').tolist()
       
   402         # pytype: enable=attribute-error
   393         self.ui.log(b'chgserver', b'received fds: %r\n', clientfds)
   403         self.ui.log(b'chgserver', b'received fds: %r\n', clientfds)
   394 
   404 
   395         ui = self.ui
   405         ui = self.ui
   396         ui.flush()
   406         ui.flush()
   397         self._saveio()
   407         self._saveio()