Load->StoreCachedTokens
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2022-11-30 07:58:37 -08:00
parent 0ba45cd59a
commit e319976832
3 changed files with 6 additions and 6 deletions

View File

@ -76,7 +76,7 @@ type cwtchPeer struct {
eventBus event.Manager 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) ci, err := cp.FetchConversationInfo(tokenServer)
if ci != nil && err == nil { if ci != nil && err == nil {
// Overwrite any existing tokens.. // Overwrite any existing tokens..

View File

@ -125,7 +125,7 @@ type CwtchPeer interface {
// Server Token APIS // Server Token APIS
// TODO move these to feature protected interfaces // TODO move these to feature protected interfaces
LoadCachedTokens(tokenServer string, tokens []*privacypass.Token) StoreCachedTokens(tokenServer string, tokens []*privacypass.Token)
// Profile Management // Profile Management
CheckPassword(password string) bool CheckPassword(password string) bool

View File

@ -260,7 +260,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
log.Infoln("Alice joining server...") log.Infoln("Alice joining server...")
if serverOnion, err := alice.AddServer(string(serverKeyBundle)); err != nil { if serverOnion, err := alice.AddServer(string(serverKeyBundle)); err != nil {
if len(cachedTokens) > len(aliceLines) { 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) t.Fatalf("Failed to Add Server Bundle %v", err)
@ -295,7 +295,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
err = bob.ImportBundle(overlayMessage.Data) err = bob.ImportBundle(overlayMessage.Data)
log.Infof("Result of Bob Importing the Bundle from Alice: %v", err) log.Infof("Result of Bob Importing the Bundle from Alice: %v", err)
if len(cachedTokens) > (usedTokens + len(bobLines)) { 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) usedTokens += len(bobLines)
} }
@ -324,7 +324,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
log.Infof("Waiting for Carol to join connect to group server...") log.Infof("Waiting for Carol to join connect to group server...")
carolGroupConversationID := 3 carolGroupConversationID := 3
if len(cachedTokens) > (usedTokens + len(carolLines)) { 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) waitForConnection(t, carol, ServerAddr, connections.SYNCED)
numGoRoutinesPostCarolConnect := runtime.NumGoroutine() numGoRoutinesPostCarolConnect := runtime.NumGoroutine()
@ -394,7 +394,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1) pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
log.Infof("numGoRoutinesStart: %v\nnumGoRoutinesPostAppStart: %v\nnumGoRoutinesPostPeerStart: %v\nnumGoRoutinesPostPeerAndServerConnect: %v\n"+ 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, numGoRoutinesStart, numGoRoutinesPostAppStart, numGoRoutinesPostPeerStart, numGoRoutinesPostServerConnect,
numGoRoutinesPostAlice, numGoRoutinesPostCarolConnect, numGoRoutinesPostBob, numGoRoutinesPostCarol, numGoRoutinesPostAppShutdown) numGoRoutinesPostAlice, numGoRoutinesPostCarolConnect, numGoRoutinesPostBob, numGoRoutinesPostCarol, numGoRoutinesPostAppShutdown)