MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / EnsureShmBound

Method EnsureShmBound

Source/URLab/Private/Bridge/BridgeServer.cpp:67–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67bool UURLabBridgeServer::EnsureShmBound(const FString& SessionId)
68{
69 if (!Dispatcher.IsValid())
70 {
71 Dispatcher = MakeUnique<FURLabRpcDispatcher>();
72 }
73
74 const FString Sid = SessionId.IsEmpty() ? FString(TEXT("live")) : SessionId;
75
76 for (const TObjectPtr<UURLabRpcTransport>& T : RpcTransports)
77 {
78 UURLabShmRpcTransport* Existing = Cast<UURLabShmRpcTransport>(T);
79 if (Existing)
80 {
81 const FString ExistingSid = Existing->SessionId.IsEmpty()
82 ? FString(TEXT("live"))
83 : Existing->SessionId;
84 if (ExistingSid == Sid)
85 return true;
86 }
87 }
88
89 UURLabShmRpcTransport* Shm = NewObject<UURLabShmRpcTransport>(this, TEXT("BridgeShmTransport"));
90 Shm->SessionId = SessionId; // empty -> defaults to "live" inside Init
91 Shm->SetOwningBridge(this);
92 if (!Shm->TransportInit())
93 {
94 UE_LOG(LogURLabNet, Error,
95 TEXT("UURLabBridgeServer: SHM open failed (session=%s)"), *Sid);
96 return false;
97 }
98 RpcTransports.Add(Shm);
99 UE_LOG(LogURLabNet, Log,
100 TEXT("UURLabBridgeServer: SHM RPC bound (session=%s)"), *Sid);
101 return true;
102}
103
104void UURLabBridgeServer::Stop()
105{

Callers 2

StartServerMethod · 0.80
BeginPlayMethod · 0.80

Calls 4

IsValidMethod · 0.80
IsEmptyMethod · 0.80
SetOwningBridgeMethod · 0.45
TransportInitMethod · 0.45

Tested by

no test coverage detected