mercurial/chgserver.py
changeset 32236 c8b9943c07eb
parent 32208 d74b0cff94a9
child 32237 1ada3d18e7fb
equal deleted inserted replaced
32235:cf415777a22c 32236:c8b9943c07eb
    42 
    42 
    43 import hashlib
    43 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 
    50 from .i18n import _
    51 from .i18n import _
    51 
    52 
   514         # use a unique temp address so we can stat the file and do ownership
   515         # use a unique temp address so we can stat the file and do ownership
   515         # check later
   516         # check later
   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)
   522 
   524 
   523     def _createsymlink(self):
   525     def _createsymlink(self):