Skip to content

Commit 8eec6e8

Browse files
authored
Set threaded to False by default in sr1. (#4641)
* Proposal: Set threaded to False in sr1. If the user doesn't specifiy threaded, we should set it to False in sr1 to eliminate the overhead of a thread creation * Apply feedback
1 parent 0f2b394 commit 8eec6e8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scapy/supersocket.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ def sr1(self, *args, **kargs):
250250
"""Send one packet and receive one answer
251251
"""
252252
from scapy import sendrecv
253+
# if not explicitly specified by the user,
254+
# set threaded to False in sr1 to remove the overhead
255+
# for a Thread creation
256+
kargs.setdefault("threaded", False)
253257
ans = sendrecv.sndrcv(self, *args, **kargs)[0] # type: SndRcvList
254258
if len(ans) > 0:
255259
pkt = ans[0][1] # type: Packet

0 commit comments

Comments
 (0)