lib9p

Go 9P library.
Log | Files | Refs

commit f9d8df1001c4f92056eb6f6dccc457f5415b1175
parent 568032591eaf175f7d5b6cfc4a20e0e927fba94a
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Mon,  9 Oct 2023 11:28:57 +0900

gofmt

Diffstat:
Mclient.go | 12++++++------
Mreq.go | 20++++++++++----------
2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/client.go b/client.go @@ -18,6 +18,7 @@ type Client struct { } type LibErr string + func (e LibErr) Error() string { return string(e) } func newLibErrMsg(format string, a ...any) *RError { return &RError{tag: NOTAG, ename: fmt.Errorf(format, a...)} @@ -117,7 +118,7 @@ func (c *Client) runMultiplexer(ctx context.Context, tmsgc chan<- Msg, rmsgc <-c req.rmsg = msg go func() { defer close(req.rxc) - select{ + select { case <-req.ctxDone: case req.rxc <- req: } @@ -133,7 +134,7 @@ func (c *Client) runMultiplexer(ctx context.Context, tmsgc chan<- Msg, rmsgc <-c select { case <-ctx.Done(): return - case req := <- txc: + case req := <-txc: reqc <- req go func() { tmsgc <- req.tmsg @@ -178,10 +179,10 @@ func (c *Client) Auth(ctx context.Context, afid uint32, uname, aname string) (Ms func (c *Client) Attach(ctx context.Context, fid, afid uint32, uname, aname string) (Msg, error) { tmsg := &TAttach{ - fid: fid, - afid: afid, + fid: fid, + afid: afid, uname: uname, aname: aname, } return c.transact(ctx, tmsg) -} -\ No newline at end of file +} diff --git a/req.go b/req.go @@ -63,12 +63,12 @@ func (rp *ReqPool) delete(tag uint16) { } type clientReq struct { - tag uint16 - pool *clientReqPool - tmsg Msg - rmsg Msg - err error - rxc chan *clientReq + tag uint16 + pool *clientReqPool + tmsg Msg + rmsg Msg + err error + rxc chan *clientReq ctxDone <-chan struct{} } @@ -112,10 +112,10 @@ func (rp *clientReqPool) add(ctx context.Context, msg Msg) (*clientReq, error) { msg.SetTag(tag) req := &clientReq{ - tag: tag, - pool: rp, - tmsg: msg, - rxc: make(chan *clientReq), + tag: tag, + pool: rp, + tmsg: msg, + rxc: make(chan *clientReq), ctxDone: ctx.Done(), } rp.m[tag] = req