mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
Send raw payloads over UDP and emit them as udp events
Review feedback from Cooldude2606: UDP is most useful for arbitrary blobs, so send_udp now takes any string and the packet is just "channel?payload". Plugins get it as a udp-<channel> event with the payload as a Buffer, or through handleUdp which logs handler errors like handle does for ipc events. The host socket is now opened when the RCON client is started and closed where the RCON client is ended, matching how the RCON client is handled, instead of being bound in start() and closed by _resetState. The integration round trip moved to the FactorioServer tests, where it sends a packet each way through a real server without the module. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b0238b64b
commit
7a64706c82
8 files changed
+222
-134
No files matched your search
@@ -73,9 +73,7 @@ function api.send_udp(channel, data)
|
||||
return -- Lua UDP is not enabled for this instance
|
||||
end
|
||||
|
||||
channel = escape_channel(channel)
|
||||
data = compat.table_to_json(data)
|
||||
helpers.send_udp(port, "\f$ipc:" .. channel .. "?j" .. data, 0)
|
||||
helpers.send_udp(port, escape_channel(channel) .. "?" .. data, 0)
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user