Skip to content

Commit f87491f

Browse files
authored
Merge pull request #2772 from gpotter2/outdated-cleanup
Remove unused read_allowed_exceptions
2 parents 294a787 + b4a85b8 commit f87491f

File tree

6 files changed

+4
-13
lines changed

6 files changed

+4
-13
lines changed

scapy/arch/windows/native.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ def send(self, x):
151151
self.outs.sendto(data, (dst_ip, 0))
152152

153153
def nonblock_recv(self, x=MTU):
154-
return self.recv()
154+
try:
155+
return self.recv()
156+
except IOError:
157+
return None
155158

156159
# https://docs.microsoft.com/en-us/windows/desktop/winsock/tcp-ip-raw-sockets-2 # noqa: E501
157160
# - For IPv4 (address family of AF_INET), an application receives the IP

scapy/automaton.py

-2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ def select_objects(inputs, remain):
197197

198198

199199
class ObjectPipe(SelectableObject):
200-
read_allowed_exceptions = ()
201-
202200
def __init__(self):
203201
self.closed = False
204202
self.rd, self.wr = os.pipe()

scapy/layers/can.py

-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ def rdcandump(filename, count=-1, interface=None):
327327
class CandumpReader:
328328
"""A stateful candump reader. Each packet is returned as a CAN packet"""
329329

330-
read_allowed_exceptions = () # emulate SuperSocket
331330
nonblocking_socket = True
332331

333332
def __init__(self, filename, interface=None):

scapy/sendrecv.py

-7
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,6 @@ def _write_to_pcap(packets_list):
908908

909909
# Get select information from the sockets
910910
_main_socket = next(iter(sniff_sockets))
911-
read_allowed_exceptions = _main_socket.read_allowed_exceptions
912911
select_func = _main_socket.select
913912
_backup_read_func = _main_socket.__class__.recv
914913
nonblocking_socket = _main_socket.nonblocking_socket
@@ -918,10 +917,6 @@ def _write_to_pcap(packets_list):
918917
"The used select function "
919918
"will be the one of the first socket")
920919

921-
# Fill if empty
922-
if not read_allowed_exceptions:
923-
read_allowed_exceptions = (IOError,)
924-
925920
if nonblocking_socket:
926921
# select is non blocking
927922
def stop_cb():
@@ -971,8 +966,6 @@ def stop_cb():
971966
pass
972967
dead_sockets.append(s)
973968
continue
974-
except read_allowed_exceptions:
975-
continue
976969
except Exception as ex:
977970
msg = " It was closed."
978971
try:

scapy/supersocket.py

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class SuperSocket(six.with_metaclass(_SuperSocket_metaclass)):
6060
desc = None
6161
closed = 0
6262
nonblocking_socket = False
63-
read_allowed_exceptions = ()
6463
auxdata_available = False
6564

6665
def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0): # noqa: E501

scapy/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,6 @@ def open(filename):
10121012
class RawPcapReader(six.with_metaclass(PcapReader_metaclass)):
10131013
"""A stateful pcap reader. Each packet is returned as a string"""
10141014

1015-
read_allowed_exceptions = () # emulate SuperSocket
10161015
nonblocking_socket = True
10171016
PacketMetadata = collections.namedtuple("PacketMetadata",
10181017
["sec", "usec", "wirelen", "caplen"]) # noqa: E501

0 commit comments

Comments
 (0)