mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Reverse argument order for sendTo
It makes more sense to put the address first then have the large structure to send as the second argument to sendTo. The opposite order was originally chosen to be similar to that of sendto in BSD sockets.
This commit is contained in:
1 parent
183d2921a8
commit
295cc7543a
24 files changed
+87
-74
No files matched your search
@@ -338,7 +338,7 @@ describe("Integration of Clusterio", function() {
|
||||
let savesDir = path.join("temp", "test", "instances", "test", "saves");
|
||||
await fs.copy(path.join(savesDir, "world.zip"), path.join(savesDir, "_autosave1.zip"));
|
||||
await execCtl("instance start test");
|
||||
let saves = await getControl().sendTo(new libData.InstanceListSavesRequest(), { instanceId: 44 });
|
||||
let saves = await getControl().sendTo({ instanceId: 44 }, new libData.InstanceListSavesRequest());
|
||||
let running = saves.find(s => s.loaded);
|
||||
assert(running.name !== "_autosave1.zip");
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ async function execCtl(...args) {
|
||||
}
|
||||
|
||||
async function sendRcon(instanceId, command) {
|
||||
return await control.sendTo(new libData.InstanceSendRconRequest(command), { instanceId });
|
||||
return await control.sendTo({ instanceId }, new libData.InstanceSendRconRequest(command));
|
||||
}
|
||||
|
||||
function getControl() {
|
||||
@@ -234,9 +234,10 @@ before(async function() {
|
||||
testPack.factorioVersion = "1.1.0";
|
||||
testPack.mods.set("clusterio_lib", { name: "clusterio_lib", enabled: true, version: "0.1.2" });
|
||||
testPack.mods.set("subspace_storage", { name: "subspace_storage", enabled: true, version: "1.99.8" });
|
||||
await control.sendTo(new libData.ModPackCreateRequest(testPack), "controller");
|
||||
await control.sendTo("controller", new libData.ModPackCreateRequest(testPack));
|
||||
await control.sendTo(
|
||||
new libData.ControllerConfigSetFieldRequest("controller.default_mod_pack_id", "12"), "controller"
|
||||
"controller",
|
||||
new libData.ControllerConfigSetFieldRequest("controller.default_mod_pack_id", "12"),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user