Skip to content

Commit

Permalink
sign moved to begining of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ivcosla committed May 21, 2019
1 parent 43197f9 commit 90b8f84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 4 additions & 8 deletions pkg/messaging-discovery/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ func (c *httpClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry

e.Sequence++
e.Timestamp = time.Now().UnixNano()
err := e.Sign(sk)
if err != nil {
return err
}

for {
err := e.Sign(sk)
if err != nil {
return err
}
err = c.SetEntry(ctx, e)
if err == nil {
return nil
Expand All @@ -144,10 +144,6 @@ func (c *httpClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry
return nil
}
e.Sequence = rE.Sequence + 1
err := e.Sign(sk)
if err != nil {
return err
}
}
}

Expand Down
12 changes: 4 additions & 8 deletions pkg/messaging-discovery/client/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ func (m *mockClient) SetEntry(ctx context.Context, e *Entry) error {
func (m *mockClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry) error {
e.Sequence++
e.Timestamp = time.Now().UnixNano()
err := e.Sign(sk)
if err != nil {
return err
}

for {
err := e.Sign(sk)
if err != nil {
return err
}
err = m.SetEntry(ctx, e)
if err == nil {
return nil
Expand All @@ -109,10 +109,6 @@ func (m *mockClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry
return nil
}
e.Sequence = rE.Sequence + 1
err := e.Sign(sk)
if err != nil {
return err
}
}
}

Expand Down

0 comments on commit 90b8f84

Please sign in to comment.