Commit 9078f477 authored by Jonas Kaufmann's avatar Jonas Kaufmann
Browse files

orchestration/instantiation/get_socket(): rename to update_get_socket() since...

orchestration/instantiation/get_socket(): rename to update_get_socket() since function has side-effects
parent 423b30f1
......@@ -186,19 +186,19 @@ class Instantiation():
new_socket = inst_socket.Socket(path=new_path, ty=new_ty)
return new_socket
def get_socket(self, interface: sys_base.Interface) -> inst_socket.Socket | None:
def update_get_socket(self, interface: sys_base.Interface) -> inst_socket.Socket | None:
socket = self._get_socket_by_interface(interface=interface)
if socket:
return socket
return None
def _get_socket(
def _update_get_socket(
self, interface: sys_base.Interface, socket_type: inst_socket.SockType
) -> inst_socket.Socket:
if self._opposing_interface_within_same_sim(interface=interface):
raise Exception(
"we do not create a socket for interfacces taht both beloing to the same simulator"
"we do not create a socket for channels where both interfaces belong to the same simulator"
)
# check if already a socket is associated with this interface
......
......@@ -232,7 +232,7 @@ class Simulator(utils_base.IdObj, abc.ABC):
raise Exception("comp must be a simulators component")
sockets = []
for interface in comp.interfaces():
socket = inst.get_socket(interface=interface)
socket = inst.update_get_socket(interface=interface)
if socket:
sockets.append(socket)
return sockets
......
......@@ -180,7 +180,7 @@ class Gem5Sim(HostSim):
interfaces=fsh_interfaces, ty=sys_pcie.PCIeHostInterface
)
for inf in pci_interfaces:
socket = inst.get_socket(interface=inf)
socket = inst.update_get_socket(interface=inf)
if socket is None:
continue
assert socket._type == inst_socket.SockType.CONNECT
......@@ -197,7 +197,7 @@ class Gem5Sim(HostSim):
interfaces=fsh_interfaces, ty=sys_mem.MemHostInterface
)
for inf in mem_interfaces:
socket = inst.get_socket(interface=inf)
socket = inst.update_get_socket(interface=inf)
if socket is None:
continue
assert socket._type == inst_socket.SockType.CONNECT
......@@ -335,7 +335,7 @@ class QemuSim(HostSim):
interfaces=fsh_interfaces, ty=sys_pcie.PCIeHostInterface
)
for inf in pci_interfaces:
socket = inst.get_socket(interface=inf)
socket = inst.update_get_socket(interface=inf)
if socket is None:
continue
assert socket._type is inst_socket.SockType.CONNECT
......
......@@ -75,11 +75,11 @@ class NICSim(PCIDevSim):
assert len(nic_devices) == 1
nic_device = nic_devices[0]
socket = inst.get_socket(interface=nic_device._pci_if)
socket = inst.update_get_socket(interface=nic_device._pci_if)
assert socket is not None and socket._type == inst_socket.SockType.LISTEN
cmd += f"{socket._path} "
socket = inst.get_socket(interface=nic_device._eth_if)
socket = inst.update_get_socket(interface=nic_device._eth_if)
assert socket is not None and socket._type == inst_socket.SockType.LISTEN
cmd += f"{socket._path} "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment