Skip to content

Commit b4a85b8

Browse files
committed
Remove unused read_allowed_exceptions
1 parent 63407c5 commit b4a85b8

6 files changed

Lines changed: 4 additions & 13 deletions

File tree

scapy/arch/windows/native.py

Lines changed: 4 additions & 1 deletion
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,6 @@ def _write_to_pcap(packets_list):
904904

905905
# Get select information from the sockets
906906
_main_socket = next(iter(sniff_sockets))
907-
read_allowed_exceptions = _main_socket.read_allowed_exceptions
908907
select_func = _main_socket.select
909908
_backup_read_func = _main_socket.__class__.recv
910909
nonblocking_socket = _main_socket.nonblocking_socket
@@ -914,10 +913,6 @@ def _write_to_pcap(packets_list):
914913
"The used select function "
915914
"will be the one of the first socket")
916915

917-
# Fill if empty
918-
if not read_allowed_exceptions:
919-
read_allowed_exceptions = (IOError,)
920-
921916
if nonblocking_socket:
922917
# select is non blocking
923918
def stop_cb():
@@ -967,8 +962,6 @@ def stop_cb():
967962
pass
968963
dead_sockets.append(s)
969964
continue
970-
except read_allowed_exceptions:
971-
continue
972965
except Exception as ex:
973966
msg = " It was closed."
974967
try:

scapy/supersocket.py

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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)