diff --git a/internal/api/rust/rust.go b/internal/api/rust/rust.go index 8c235c4..6c6bf98 100644 --- a/internal/api/rust/rust.go +++ b/internal/api/rust/rust.go @@ -42,7 +42,7 @@ func SetupLogs(prefix string) { var zero uint32 const ( - OptionEnableCrossProcessRefreshLockProcessName = "EnableCrossProcessRefreshLockProcessName" + CrossProcessStoreLocksHolderName = "CrossProcessStoreLocksHolderName" ) // magic value for EnableCrossProcessRefreshLockProcessName which configures the FFI client @@ -76,16 +76,16 @@ func NewRustClient(t ct.TestLike, opts api.ClientCreationOpts) (api.Client, erro t.Logf("NewRustClient[%s][%s] creating...", opts.UserID, opts.DeviceID) matrix_sdk_ffi.LogEvent("rust.go", &zero, matrix_sdk_ffi.LogLevelInfo, t.Name(), fmt.Sprintf("NewRustClient[%s][%s] creating...", opts.UserID, opts.DeviceID)) slidingSyncVersion := matrix_sdk_ffi.SlidingSyncVersionBuilderNative{} + clientSessionDelegate := NewMemoryClientSessionDelegate() ab := matrix_sdk_ffi.NewClientBuilder(). HomeserverUrl(opts.BaseURL). SlidingSyncVersionBuilder(slidingSyncVersion). - AutoEnableCrossSigning(true) - var clientSessionDelegate matrix_sdk_ffi.ClientSessionDelegate - xprocessName := opts.GetExtraOption(OptionEnableCrossProcessRefreshLockProcessName, "").(string) + AutoEnableCrossSigning(true). + SetSessionDelegate(clientSessionDelegate) + xprocessName := opts.GetExtraOption(CrossProcessStoreLocksHolderName, "").(string) if xprocessName != "" { - t.Logf("enabling cross process refresh lock with proc name=%s", xprocessName) - clientSessionDelegate = NewMemoryClientSessionDelegate() - ab = ab.EnableCrossProcessRefreshLock(xprocessName, clientSessionDelegate) + t.Logf("setting cross process store locks holder name=%s", xprocessName) + ab = ab.CrossProcessStoreLocksHolderName(xprocessName) } // @alice:hs1, FOOBAR => alice_hs1_FOOBAR username := strings.Replace(opts.UserID[1:], ":", "_", -1) + "_" + opts.DeviceID @@ -345,9 +345,9 @@ func (c *RustClient) StartSyncing(t ct.TestLike) (stopSyncing func(), err error) // > thread '' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime' // where the stack trace doesn't hit any test code, but does start at a `free_` function. sb := c.FFIClient.SyncService() - xprocessName := c.opts.GetExtraOption(OptionEnableCrossProcessRefreshLockProcessName, "").(string) + xprocessName := c.opts.GetExtraOption(CrossProcessStoreLocksHolderName, "").(string) if xprocessName != "" { - sb2 := sb.WithCrossProcessLock(&xprocessName) + sb2 := sb.WithCrossProcessLock() sb.Destroy() sb = sb2 } diff --git a/tests/rust/notification_test.go b/tests/rust/notification_test.go index 57dc33c..33856f5 100644 --- a/tests/rust/notification_test.go +++ b/tests/rust/notification_test.go @@ -63,7 +63,7 @@ func testNSEReceive(t *testing.T, numMsgsBefore, numMsgsAfter int) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -88,7 +88,7 @@ func testNSEReceive(t *testing.T, numMsgsBefore, numMsgsAfter int) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: rust.ProcessNameNSE, + rust.CrossProcessStoreLocksHolderName: rust.ProcessNameNSE, }, AccessToken: accessToken, }, @@ -110,7 +110,7 @@ func TestNSEReceiveForNonPreKeyMessage(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -137,7 +137,7 @@ func TestNSEReceiveForNonPreKeyMessage(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: rust.ProcessNameNSE, + rust.CrossProcessStoreLocksHolderName: rust.ProcessNameNSE, }, AccessToken: accessToken, }, @@ -164,7 +164,7 @@ func TestMultiprocessNSE(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -201,7 +201,7 @@ func TestMultiprocessNSE(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, AccessToken: accessToken, }, @@ -222,7 +222,7 @@ func TestMultiprocessNSE(t *testing.T) { PersistentStorage: true, AccessToken: accessToken, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) // this should login already as we provided an access token @@ -261,7 +261,7 @@ func TestMultiprocessNSE(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: rust.ProcessNameNSE, + rust.CrossProcessStoreLocksHolderName: rust.ProcessNameNSE, }, AccessToken: accessToken, }, @@ -300,7 +300,7 @@ func TestMultiprocessNSE(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -324,7 +324,7 @@ func TestMultiprocessNSEBackupKeyMacError(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -358,7 +358,7 @@ func TestMultiprocessNSEBackupKeyMacError(t *testing.T) { PersistentStorage: true, AccessToken: accessToken, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) // this should login already as we provided an access token @@ -377,7 +377,7 @@ func TestMultiprocessNSEBackupKeyMacError(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: rust.ProcessNameNSE, + rust.CrossProcessStoreLocksHolderName: rust.ProcessNameNSE, }, AccessToken: accessToken, }, @@ -419,7 +419,7 @@ func TestMultiprocessNSEBackupKeyMacError(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -443,7 +443,7 @@ func TestMultiprocessNSEOlmSessionWedge(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -478,7 +478,7 @@ func TestMultiprocessNSEOlmSessionWedge(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, AccessToken: accessToken, }, @@ -503,7 +503,7 @@ func TestMultiprocessNSEOlmSessionWedge(t *testing.T) { PersistentStorage: true, AccessToken: accessToken, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: rust.ProcessNameNSE, + rust.CrossProcessStoreLocksHolderName: rust.ProcessNameNSE, }, }, }) // this should login already as we provided an access token @@ -639,7 +639,7 @@ func TestMultiprocessInitialE2EESyncDoesntDropDeviceListUpdates(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, }, }) @@ -673,7 +673,7 @@ func TestMultiprocessInitialE2EESyncDoesntDropDeviceListUpdates(t *testing.T) { Opts: api.ClientCreationOpts{ PersistentStorage: true, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: "main", + rust.CrossProcessStoreLocksHolderName: "main", }, AccessToken: accessToken, }, @@ -687,7 +687,7 @@ func TestMultiprocessInitialE2EESyncDoesntDropDeviceListUpdates(t *testing.T) { PersistentStorage: true, AccessToken: accessToken, ExtraOpts: map[string]any{ - rust.OptionEnableCrossProcessRefreshLockProcessName: rust.ProcessNameNSE, + rust.CrossProcessStoreLocksHolderName: rust.ProcessNameNSE, }, }, }) // this should login already as we provided an access token