static long dm_evalOnOtherMachineWithReturnValue_timeout = 60000; sO dm_evalOnOtherMachineWithReturnValue(fS computerID, S code, O... _) { fS id = aGlobalID(); final new Var<Either<O, S>> var; temp vmBus_onMessage('gotFromPrivateChat, voidfunc(S sender, S msg) { if (var.has() || neq(sender, computerID)) ret; new Matches m; if (!startsWith(msg, "done " + id + " ", m)) ret; if (neq(getAuthorOfSignedText(msg), computerID)) { File f = javaxCachesDir("failed-eval-msg-" + computerID); saveTextFile(f, msg); var.set((Either) eitherB("eval result from " + computerID + " did not verify, saved as " + f)); } S s = firstLine(m.rest()); if (startsWith(s, "direct: ", m)) var.set((Either) eitherA(m.rest())); else if (startsWith(s, "quoted: ", m)) var.set((Either) eitherA(unquote(m.rest()))); else if (startsWith(s, "base64: ", m)) var.set((Either) eitherA(base64decode(m.rest()))); else if (startsWith(s, "error: ", m)) var.set((Either) eitherB(m.rest())); else var.set((Either) eitherB("unknown mode")); }); dm_privateChat_sendSigned(computerID, computerID + " eval " + (boolOptPar(_, 'realEval) ? "real " : "") + (boolOptPar(_, 'fresh) ? "fresh " : "") + id + ": " + code); Either<O, S> e = waitForVarToBeNotNullWithTimeout(var, dm_evalOnOtherMachineWithReturnValue_timeout); if (boolPar updateControllableFlag(_)) dm_pcall('controllableComputerList, 'setControllableByMe, computerID, eitherIsA(e)); if (e == null) fail("timeout"); if (eitherIsB(e)) fail(eitherGetB(e)); ret eitherGetA(e); }
Began life as a copy of #1019606
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, snaazhdonpnp, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1019610 |
Snippet name: | dm_evalOnOtherMachineWithReturnValue |
Eternal ID of this version: | #1019610/28 |
Text MD5: | 57eda72f41247f2f71ea994d58d2987d |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-10 11:03:36 |
Source code size: | 1660 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 392 / 526 |
Version history: | 27 change(s) |
Referenced in: | [show references] |