From 11a64a5b55eb1442da49bc0440766746f6e1a24d Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 15 Oct 2023 23:43:38 -0400 Subject: [PATCH] Fixes #1396 (#1508) --- OpenDreamRuntime/DreamManager.Connections.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenDreamRuntime/DreamManager.Connections.cs b/OpenDreamRuntime/DreamManager.Connections.cs index 7b72d739ef..9987b54deb 100644 --- a/OpenDreamRuntime/DreamManager.Connections.cs +++ b/OpenDreamRuntime/DreamManager.Connections.cs @@ -122,7 +122,16 @@ private async Task ConsumeAndHandleWorldTopicSocket(Socket remote, CancellationT var remoteAddress = (remote.RemoteEndPoint as IPEndPoint)!.Address.ToString(); _sawmill.Debug($"World Topic #{topicId}: '{remoteAddress}' -> '{topic}'"); - var topicResponse = WorldInstance.SpawnProc("Topic", null, new DreamValue(topic), new DreamValue(remoteAddress)); + var tcs = new TaskCompletionSource(); + DreamThread.Run("Topic Handler", async state => { + var topicProc = WorldInstance.GetProc("Topic"); + + var result = await state.Call(topicProc, WorldInstance, null, new DreamValue(topic), new DreamValue(remoteAddress)); + tcs.SetResult(result); + return result; + }); + + var topicResponse = await tcs.Task; if (topicResponse.IsNull) { return; }