Skip to content

Commit

Permalink
Add missing references
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelsr committed Sep 8, 2023
1 parent caf600e commit 0c58956
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cap/capstore/capstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (c CapStore) Set(ctx context.Context, id string, cap capnp.Client) error {
if err := cs.SetId(id); err != nil {
return err
}
return cs.SetCap(cap)
return cs.SetCap(cap.AddRef())
})
defer release()

Expand All @@ -43,5 +43,5 @@ func (c CapStore) Get(ctx context.Context, id string) (capnp.Client, error) {
return capnp.Client{}, err
}

return res.Cap(), nil
return res.Cap().AddRef(), nil
}
4 changes: 2 additions & 2 deletions cap/capstore/server/capstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (c *CapStore) Set(ctx context.Context, call api.CapStore_set) error {
cap := call.Args().Cap()
c.Logger.Info("set capability", "id", id)

c.Map.Store(id, cap)
c.Map.Store(id, cap.AddRef())
return nil
}

Expand All @@ -56,5 +56,5 @@ func (c *CapStore) Get(ctx context.Context, call api.CapStore_get) error {
return err
}

return res.SetCap(cap)
return res.SetCap(cap.AddRef())
}
Binary file modified rom/internal/main.wasm
Binary file not shown.

0 comments on commit 0c58956

Please sign in to comment.