425 Write a non-empty list of '\0' separated instruction strings or '\0' |
425 Write a non-empty list of '\0' separated instruction strings or '\0' |
426 if the list is empty. |
426 if the list is empty. |
427 An instruction string could be either: |
427 An instruction string could be either: |
428 - "unlink $path", the client should unlink the path to stop the |
428 - "unlink $path", the client should unlink the path to stop the |
429 outdated server. |
429 outdated server. |
430 - "redirect $path", the client should try to connect to another |
430 - "redirect $path", the client should attempt to connect to $path |
431 server instead. |
431 first. If it does not work, start a new server. It implies |
|
432 "reconnect". |
432 - "exit $n", the client should exit directly with code n. |
433 - "exit $n", the client should exit directly with code n. |
433 This may happen if we cannot parse the config. |
434 This may happen if we cannot parse the config. |
|
435 - "reconnect", the client should close the connection and |
|
436 reconnect. |
|
437 If neither "reconnect" nor "redirect" is included in the instruction |
|
438 list, the client can continue with this server after completing all |
|
439 the instructions. |
434 """ |
440 """ |
435 args = self._readlist() |
441 args = self._readlist() |
436 try: |
442 try: |
437 self.ui = _renewui(self.ui, args) |
443 self.ui = _renewui(self.ui, args) |
438 except error.ParseError as inst: |
444 except error.ParseError as inst: |
443 newhash = hashstate.fromui(self.ui, self.hashstate.mtimepaths) |
449 newhash = hashstate.fromui(self.ui, self.hashstate.mtimepaths) |
444 insts = [] |
450 insts = [] |
445 if newhash.mtimehash != self.hashstate.mtimehash: |
451 if newhash.mtimehash != self.hashstate.mtimehash: |
446 addr = _hashaddress(self.baseaddress, self.hashstate.confighash) |
452 addr = _hashaddress(self.baseaddress, self.hashstate.confighash) |
447 insts.append('unlink %s' % addr) |
453 insts.append('unlink %s' % addr) |
|
454 insts.append('reconnect') |
448 if newhash.confighash != self.hashstate.confighash: |
455 if newhash.confighash != self.hashstate.confighash: |
449 addr = _hashaddress(self.baseaddress, newhash.confighash) |
456 addr = _hashaddress(self.baseaddress, newhash.confighash) |
450 insts.append('redirect %s' % addr) |
457 insts.append('redirect %s' % addr) |
451 _log('validate: %s\n' % insts) |
458 _log('validate: %s\n' % insts) |
452 self.cresult.write('\0'.join(insts) or '\0') |
459 self.cresult.write('\0'.join(insts) or '\0') |