MCPcopy Index your code
hub / github.com/secdev/scapy / unregister

Method unregister

scapy/contrib/cansocket_python_can.py:174–194  ·  view source on GitHub ↗

Unregisters a SocketWrapper from its subscription to a SocketMapper. If a SocketMapper doesn't have any subscribers, the python-can Bus get shutdown. :param socket: SocketWrapper to be unregistered

(self, socket)

Source from the content-addressed store, hash-verified

172 self.pool[k] = SocketMapper(bus, [socket])
173
174 def unregister(self, socket):
175 # type: (SocketWrapper) -> None
176 """Unregisters a SocketWrapper from its subscription to a SocketMapper.
177
178 If a SocketMapper doesn't have any subscribers, the python-can Bus
179 get shutdown.
180
181 :param socket: SocketWrapper to be unregistered
182 """
183 if socket.name is None:
184 raise TypeError("SocketWrapper.name should never be None")
185
186 with self.pool_mutex:
187 try:
188 t = self.pool[socket.name]
189 t.sockets.remove(socket)
190 if not t.sockets:
191 t.bus.shutdown()
192 del self.pool[socket.name]
193 except KeyError:
194 warning("Socket %s already removed from pool" % socket.name)
195
196
197SocketsPool = _SocketsPool()

Callers 1

shutdownMethod · 0.80

Calls 3

warningFunction · 0.90
shutdownMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected