| 65 | } |
| 66 | |
| 67 | bool 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 | |
| 104 | void UURLabBridgeServer::Stop() |
| 105 | { |
no test coverage detected