Skip to content

Commit

Permalink
multiple: use pointers instead of direct structs (#63)
Browse files Browse the repository at this point in the history
* proto: Use pointers to the message types.

* p9: Fix API breakage.

* p9: Missed one.
  • Loading branch information
DeedleFake authored Oct 13, 2019
1 parent 2e71cfd commit 0e2fa96
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 111 deletions.
12 changes: 6 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ func (c *Client) nextFID() uint32 {
// allowed message size. A handshake must be performed before any
// other request types may be sent.
func (c *Client) Handshake(msize uint32) (uint32, error) {
rsp, err := c.Send(Tversion{
rsp, err := c.Send(&Tversion{
Msize: msize,
Version: Version,
})
if err != nil {
return 0, err
}

version := rsp.(Rversion)
version := rsp.(*Rversion)
if version.Version != Version {
return 0, ErrUnsupportedVersion
}
Expand All @@ -73,15 +73,15 @@ func (c *Client) Handshake(msize uint32) (uint32, error) {
func (c *Client) Auth(user, aname string) (*Remote, error) {
fid := c.nextFID()

rsp, err := c.Send(Tauth{
rsp, err := c.Send(&Tauth{
AFID: fid,
Uname: user,
Aname: aname,
})
if err != nil {
return nil, err
}
rauth := rsp.(Rauth)
rauth := rsp.(*Rauth)

return &Remote{
client: c,
Expand All @@ -101,7 +101,7 @@ func (c *Client) Attach(afile *Remote, user, aname string) (*Remote, error) {
afid = afile.fid
}

rsp, err := c.Send(Tattach{
rsp, err := c.Send(&Tattach{
FID: fid,
AFID: afid,
Uname: user,
Expand All @@ -110,7 +110,7 @@ func (c *Client) Attach(afile *Remote, user, aname string) (*Remote, error) {
if err != nil {
return nil, err
}
attach := rsp.(Rattach)
attach := rsp.(*Rattach)

return &Remote{
client: c,
Expand Down
Loading

0 comments on commit 0e2fa96

Please sign in to comment.