Improve logic for logging into the websocket of the target node

This commit is contained in:
Matthew Penner 2020-12-16 18:54:01 -07:00
parent 5c5e2e24f1
commit 01926e2896
6 changed files with 63 additions and 31 deletions

View file

@ -112,7 +112,6 @@ class ServerTransferController extends Controller
// Unsuspend the server and don't continue the transfer.
if (! $request->input('successful')) {
//$this->suspensionService->toggle($server, 'unsuspend');
$server->transfer->forceFill([
'successful' => false,
])->saveOrFail();
@ -142,6 +141,12 @@ class ServerTransferController extends Controller
->relatedTo($server->uuid, true)
->getToken($signer, new Key($server->node->getDecryptedKey()));
// Update the archived field on the transfer to make clients connect to the websocket
// on the new node to be able to receive transfer logs.
$server->transfer->forceFill([
'archived' => true,
])->saveOrFail();
// On the daemon transfer repository, make sure to set the node after the server
// because setServer() tells the repository to use the server's node and not the one
// we want to specify.