From e319976832794d16f1a79b41476c12b042adf358 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 30 Nov 2022 07:58:37 -0800 Subject: [PATCH] Load->StoreCachedTokens --- peer/cwtch_peer.go | 2 +- peer/profile_interface.go | 2 +- testing/cwtch_peer_server_integration_test.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index e67d999..2911630 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -76,7 +76,7 @@ type cwtchPeer struct { eventBus event.Manager } -func (cp *cwtchPeer) LoadCachedTokens(tokenServer string, tokens []*privacypass.Token) { +func (cp *cwtchPeer) StoreCachedTokens(tokenServer string, tokens []*privacypass.Token) { ci, err := cp.FetchConversationInfo(tokenServer) if ci != nil && err == nil { // Overwrite any existing tokens.. diff --git a/peer/profile_interface.go b/peer/profile_interface.go index 9e95a56..51d6c38 100644 --- a/peer/profile_interface.go +++ b/peer/profile_interface.go @@ -125,7 +125,7 @@ type CwtchPeer interface { // Server Token APIS // TODO move these to feature protected interfaces - LoadCachedTokens(tokenServer string, tokens []*privacypass.Token) + StoreCachedTokens(tokenServer string, tokens []*privacypass.Token) // Profile Management CheckPassword(password string) bool diff --git a/testing/cwtch_peer_server_integration_test.go b/testing/cwtch_peer_server_integration_test.go index ce554ca..e1f95ed 100644 --- a/testing/cwtch_peer_server_integration_test.go +++ b/testing/cwtch_peer_server_integration_test.go @@ -260,7 +260,7 @@ func TestCwtchPeerIntegration(t *testing.T) { log.Infoln("Alice joining server...") if serverOnion, err := alice.AddServer(string(serverKeyBundle)); err != nil { if len(cachedTokens) > len(aliceLines) { - alice.LoadCachedTokens(serverOnion, cachedTokens[0:len(aliceLines)]) + alice.StoreCachedTokens(serverOnion, cachedTokens[0:len(aliceLines)]) } t.Fatalf("Failed to Add Server Bundle %v", err) @@ -295,7 +295,7 @@ func TestCwtchPeerIntegration(t *testing.T) { err = bob.ImportBundle(overlayMessage.Data) log.Infof("Result of Bob Importing the Bundle from Alice: %v", err) if len(cachedTokens) > (usedTokens + len(bobLines)) { - bob.LoadCachedTokens(ServerAddr, cachedTokens[usedTokens:usedTokens+len(bobLines)]) + bob.StoreCachedTokens(ServerAddr, cachedTokens[usedTokens:usedTokens+len(bobLines)]) usedTokens += len(bobLines) } @@ -324,7 +324,7 @@ func TestCwtchPeerIntegration(t *testing.T) { log.Infof("Waiting for Carol to join connect to group server...") carolGroupConversationID := 3 if len(cachedTokens) > (usedTokens + len(carolLines)) { - carol.LoadCachedTokens(ServerAddr, cachedTokens[usedTokens:usedTokens+len(carolLines)]) + carol.StoreCachedTokens(ServerAddr, cachedTokens[usedTokens:usedTokens+len(carolLines)]) } waitForConnection(t, carol, ServerAddr, connections.SYNCED) numGoRoutinesPostCarolConnect := runtime.NumGoroutine() @@ -394,7 +394,7 @@ func TestCwtchPeerIntegration(t *testing.T) { pprof.Lookup("goroutine").WriteTo(os.Stdout, 1) log.Infof("numGoRoutinesStart: %v\nnumGoRoutinesPostAppStart: %v\nnumGoRoutinesPostPeerStart: %v\nnumGoRoutinesPostPeerAndServerConnect: %v\n"+ - "numGoRoutinesPostAlice: %v\nnumGoRoutinesPostCarolConnect: %v\nnumGoRoutinesPostBob: %v\nnumGoRoutinesPostCarol: %v\nnumGoRoutinesPostAppShutdown: %v", + "numGoRoutinesPostAlice: %v\nnumGoRoutinesPostCarolConnect: %v\nnumGoRoutinesPostBob: %v\nnumGoRoutinesPostCarol: %v\nnumGoRoutinesPostAppShutdown: %v", numGoRoutinesStart, numGoRoutinesPostAppStart, numGoRoutinesPostPeerStart, numGoRoutinesPostServerConnect, numGoRoutinesPostAlice, numGoRoutinesPostCarolConnect, numGoRoutinesPostBob, numGoRoutinesPostCarol, numGoRoutinesPostAppShutdown)