MCPcopy Create free account
hub / github.com/secdev/scapy / close

Method close

scapy/layers/bluetooth.py:3118–3137  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3116 self.recv()
3117
3118 def close(self):
3119 if self.closed:
3120 return
3121
3122 # Properly close socket so we can free the device
3123 from ctypes.util import find_library
3124 libc = ctypes.cdll.LoadLibrary(find_library("c"))
3125
3126 close = libc.close
3127 close.restype = ctypes.c_int
3128 self.closed = True
3129 if hasattr(self, "outs"):
3130 if not hasattr(self, "ins") or self.ins != self.outs:
3131 if self.outs and (WINDOWS or self.outs.fileno() != -1):
3132 close(self.outs.fileno())
3133 if hasattr(self, "ins"):
3134 if self.ins and (WINDOWS or self.ins.fileno() != -1):
3135 close(self.ins.fileno())
3136 if hasattr(self, "hci_fd"):
3137 close(self.hci_fd)
3138
3139
3140class BluetoothUserSocket(_BluetoothLibcSocket):

Callers 1

srbtFunction · 0.45

Calls 1

filenoMethod · 0.45

Tested by

no test coverage detected