def _read_alive2_reply(self) -> int:
""" Read reply from ALIVE2 request, check the result code, read creation
:return: Creation value if all is well, connection remains on.
On error returns -1
"""
# Reply will be [121,0,Creation:16] for OK, otherwise [121,Error]
reply = self.sock_.recv(2)
if not reply:
print("EPMD: ALIVE2 Read error. Closed?", reply)
return -1
if reply[1] == 0:
cr = self.sock_.recv(2)
(creation,) = struct.unpack(">H", cr)
return creation
print("EPMD: ALIVE2 returned error", reply[1])
return -1
评论列表
文章目录