Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions deltachat-rpc-client/tests/test_multitransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,29 @@ def test_transport_synchronization(acfactory, log) -> None:
assert ac1_clone.wait_for_incoming_msg().get_snapshot().text == "Hello!"


def test_transport_sync_new_as_primary(acfactory, log) -> None:
"""Test synchronization of new transport as primary between devices."""
ac1 = acfactory.get_online_account()
ac1_clone = ac1.clone()
ac1_clone.bring_online()

qr = acfactory.get_account_qr()

ac1.add_transport_from_qr(qr)
ac1_transports = ac1.list_transports()
assert len(ac1_transports) == 2
[transport1, transport2] = ac1_transports
ac1_clone.wait_for_event(EventType.TRANSPORTS_MODIFIED)
assert len(ac1_clone.list_transports()) == 2
assert ac1_clone.get_config("configured_addr") == transport1["addr"]

log.section("ac1 changes the primary transport")
ac1.set_config("configured_addr", transport2["addr"])

ac1_clone.wait_for_event(EventType.TRANSPORTS_MODIFIED)
assert ac1_clone.get_config("configured_addr") == transport2["addr"]


def test_recognize_self_address(acfactory) -> None:
alice, bob = acfactory.get_online_accounts(2)

Expand Down
1 change: 1 addition & 0 deletions src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ pub(crate) async fn sync_transports(
.await?;

context.emit_event(EventType::TransportsModified);
// context.scheduler.restart(context).await;
Copy link
Collaborator Author

@iequidoo iequidoo Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't fix the bug quickly because this doesn't compile with error: future cannot be sent between threads safely [...].

Another problem is that we should fetch all existing messages from the new transport, but Config::FetchedExistingMsgs is already 1 at this moment. Otherwise the fix won't be reliable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FetchedExistingMsgs does not actually fetch messages. fetch_existing_msgs just looks for existing email addresses in unencrypted headers and adds them to contacts.

Ok(())
}

Expand Down
Loading