def accept(self, block=True):
    prev = self.sock.gettimeout()
    if (not block):
        self.sock.settimeout(0)
    try:
        s = self.sock.accept()[0]
    except OSError as e:
        logging.error('error accepting socket: %s', e)
        return None
    finally:
        self.sock.settimeout(prev)
    return ReliableSocket.from_socket(s)
def accept(self, block=True):
    prev = self.sock.gettimeout()
    if (not block):
        self.sock.settimeout(0)
    try:
        s = self.sock.accept()[0]
    except OSError as e:
        logging.error('error accepting socket: %s', e)
        return None
    finally:
        self.sock.settimeout(prev)
    return ReliableSocket.from_socket(s)