##// END OF EJS Templates
commandserver: move "listen" responsibility from service to handler...
Jun Wu -
r32232:c8b9943c default
parent child Browse files
Show More
@@ -44,6 +44,7 b' import hashlib'
44 import inspect
44 import inspect
45 import os
45 import os
46 import re
46 import re
47 import socket
47 import struct
48 import struct
48 import time
49 import time
49
50
@@ -516,6 +517,7 b' class chgunixservicehandler(object):'
516 tempaddress = _tempaddress(self._realaddress)
517 tempaddress = _tempaddress(self._realaddress)
517 util.bindunixsocket(sock, tempaddress)
518 util.bindunixsocket(sock, tempaddress)
518 self._socketstat = os.stat(tempaddress)
519 self._socketstat = os.stat(tempaddress)
520 sock.listen(socket.SOMAXCONN)
519 # rename will replace the old socket file if exists atomically. the
521 # rename will replace the old socket file if exists atomically. the
520 # old server will detect ownership change and exit.
522 # old server will detect ownership change and exit.
521 util.rename(tempaddress, self._realaddress)
523 util.rename(tempaddress, self._realaddress)
@@ -409,6 +409,7 b' class unixservicehandler(object):'
409
409
410 def bindsocket(self, sock, address):
410 def bindsocket(self, sock, address):
411 util.bindunixsocket(sock, address)
411 util.bindunixsocket(sock, address)
412 sock.listen(socket.SOMAXCONN)
412
413
413 def unlinksocket(self, address):
414 def unlinksocket(self, address):
414 os.unlink(address)
415 os.unlink(address)
@@ -452,7 +453,6 b' class unixforkingservice(object):'
452 def init(self):
453 def init(self):
453 self._sock = socket.socket(socket.AF_UNIX)
454 self._sock = socket.socket(socket.AF_UNIX)
454 self._servicehandler.bindsocket(self._sock, self.address)
455 self._servicehandler.bindsocket(self._sock, self.address)
455 self._sock.listen(socket.SOMAXCONN)
456 o = signal.signal(signal.SIGCHLD, self._sigchldhandler)
456 o = signal.signal(signal.SIGCHLD, self._sigchldhandler)
457 self._oldsigchldhandler = o
457 self._oldsigchldhandler = o
458 self._servicehandler.printbanner(self.address)
458 self._servicehandler.printbanner(self.address)
General Comments 0
You need to be logged in to leave comments. Login now