diff --git a/birdvisu/ospfsock.py b/birdvisu/ospfsock.py index b034d06..01e20a0 100644 --- a/birdvisu/ospfsock.py +++ b/birdvisu/ospfsock.py @@ -3,6 +3,7 @@ from dataclasses import dataclass,field import socket as sk from string import digits +from select import select class BirdError(Exception): def __init__(self, code, where, text): @@ -55,6 +56,10 @@ class BirdSocketConnection: code : str | None = None # string because of leading zeroes, and it has no numeric interpretation anyway start = None cont = True + # The response might not yet be ready + rrdy, wrdy, xrdy = select([self.socket], [], [], 1) + if len(rrdy) == 0: + print('WTF, no response in 1 second?') f = self.socket.makefile('r') for i, line in enumerate(f, start=1): assert cont, "WTF bad format (should not continue)."