Skip to content

Commit ca56748

Browse files
committed
Fix StreamSocket on windows
1 parent 9a91d0e commit ca56748

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

scapy/automaton.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ def select_objects(inputs, remain):
9999
events.append(i)
100100
if natives:
101101
results = results.union(set(select.select(natives, [], [], remain)[0]))
102+
if results:
103+
# We have native results, poll.
104+
remain = 0
102105
if events:
103106
# 0xFFFFFFFF = INFINITE
104107
remainms = int(remain * 1000 if remain is not None else 0xFFFFFFFF)

scapy/supersocket.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,13 @@ def recv_raw(self, x=MTU):
412412
# type: (int) -> Tuple[Optional[Type[Packet]], Optional[bytes], Optional[float]]
413413
return self.basecls, self.ins.recv(x), None
414414

415+
if WINDOWS:
416+
@staticmethod
417+
def select(sockets, remain=None):
418+
# type: (List[SuperSocket], Optional[float]) -> List[SuperSocket]
419+
from scapy.automaton import select_objects
420+
return select_objects(sockets, remain)
421+
415422

416423
class StreamSocket(SimpleSocket):
417424
"""

0 commit comments

Comments
 (0)