fix reconnect loop, bug where file transfermodel would handle every message

This commit is contained in:
marlon-erler
2026-04-06 19:19:57 +00:00
parent 3fb9785882
commit 11bb0f4a4f
3 changed files with 15 additions and 35 deletions
+8 -20
View File
@@ -4919,17 +4919,6 @@
this.handleConnectionChange = () => { this.handleConnectionChange = () => {
console.log("connection status:", this.isConnected, this.address); console.log("connection status:", this.isConnected, this.address);
this.connectionChangeHandlerManager.trigger(); this.connectionChangeHandlerManager.trigger();
if (this.isConnected == false) {
if (this.shouldAttemptReconnect == false) return;
this.reconnectInterval = setInterval(() => {
if (this.isConnected == true) {
clearInterval(this.reconnectInterval);
return;
}
this.reconnect();
}, 5e3);
return;
}
if (this.address == void 0) return; if (this.address == void 0) return;
this.storeAddress(this.address); this.storeAddress(this.address);
this.sendSubscriptionRequest(); this.sendSubscriptionRequest();
@@ -4938,6 +4927,7 @@
}; };
// connection // connection
this.connect = (address) => { this.connect = (address) => {
console.log("connecting...", address);
this.udn.connect(address); this.udn.connect(address);
}; };
this.disconnect = () => { this.disconnect = () => {
@@ -5099,6 +5089,11 @@
this.udn.onmailboxconnect = (mailboxId) => { this.udn.onmailboxconnect = (mailboxId) => {
console.log(`using mailbox ${mailboxId}`); console.log(`using mailbox ${mailboxId}`);
}; };
setInterval(() => {
if (this.isConnected == true) return;
if (this.shouldAttemptReconnect == false) return;
this.reconnect();
}, 5e3);
this.reconnect(); this.reconnect();
} }
// data // data
@@ -5470,14 +5465,7 @@
"on:click": fileTransferViewModel2.showFileSelectionModal "on:click": fileTransferViewModel2.showFileSelectionModal
}, },
translations.general.backButton translations.general.backButton
), /* @__PURE__ */ createElement( ), /* @__PURE__ */ createElement("button", { disabled: true, class: "flex" }, translations.general.waitingLabel))));
"button",
{
disabled: true,
class: "flex"
},
translations.general.waitingLabel
))));
} }
function TransferDisplayModal(fileTransferViewModel2) { function TransferDisplayModal(fileTransferViewModel2) {
const isPresented = createProxyState( const isPresented = createProxyState(
@@ -5612,7 +5600,7 @@
}; };
// handlers // handlers
this.handleMessage = (data) => { this.handleMessage = (data) => {
console.log(this.transferData); if (this.transferData == void 0) return;
if (data.messageChannel != this.transferData.channel) return; if (data.messageChannel != this.transferData.channel) return;
if (data.messageBody == _FileTransferModel.READY_MESSAGE && this.direction == 0 /* Send */) { if (data.messageBody == _FileTransferModel.READY_MESSAGE && this.direction == 0 /* Send */) {
console.log("TRIGGER"); console.log("TRIGGER");
+6 -14
View File
@@ -35,20 +35,6 @@ export default class ConnectionModel {
handleConnectionChange = (): void => { handleConnectionChange = (): void => {
console.log("connection status:", this.isConnected, this.address); console.log("connection status:", this.isConnected, this.address);
this.connectionChangeHandlerManager.trigger(); this.connectionChangeHandlerManager.trigger();
if (this.isConnected == false) {
if (this.shouldAttemptReconnect == false) return;
this.reconnectInterval = setInterval(() => {
if (this.isConnected == true) {
clearInterval(this.reconnectInterval);
return;
}
this.reconnect();
}, 5000);
return;
}
if (this.address == undefined) return; if (this.address == undefined) return;
this.storeAddress(this.address); this.storeAddress(this.address);
@@ -59,6 +45,7 @@ export default class ConnectionModel {
// connection // connection
connect = (address: string): void => { connect = (address: string): void => {
console.log("connecting...", address);
this.udn.connect(address); this.udn.connect(address);
}; };
@@ -272,6 +259,11 @@ export default class ConnectionModel {
console.log(`using mailbox ${mailboxId}`); console.log(`using mailbox ${mailboxId}`);
}; };
setInterval(() => {
if (this.isConnected == true) return;
if (this.shouldAttemptReconnect == false) return;
this.reconnect();
}, 5000)
this.reconnect(); this.reconnect();
} }
} }
+1 -1
View File
@@ -53,7 +53,7 @@ export default class FileTransferModel {
// handlers // handlers
handleMessage = (data: Message): void => { handleMessage = (data: Message): void => {
console.log(this.transferData); if (this.transferData == undefined) return;
if (data.messageChannel != this.transferData.channel) return; if (data.messageChannel != this.transferData.channel) return;
if ( if (
data.messageBody == FileTransferModel.READY_MESSAGE && data.messageBody == FileTransferModel.READY_MESSAGE &&