lib9p

Go 9P library.
Log | Files | Refs | LICENSE

commit ca96a37982b0074c21557b3c75440f13f2a38123
parent dadf3adcd68dc6d0d0d0a7977219bbc8acb582c7
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri, 29 Dec 2023 08:45:45 +0900

unexport Req.tag

Diffstat:
Mreq.go | 4++--
Mserver.go | 6+++---
Mserver2_test.go | 6+++---
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/req.go b/req.go @@ -6,7 +6,7 @@ import ( // Req represents each requests. type Req struct { - Tag uint16 + tag uint16 // Ifcall is incomming 9P message Ifcall Msg // Ofcall is response message to Ifcall. @@ -35,7 +35,7 @@ type Req struct { func (r *Req) flush() { // TODO: need mutex? close(r.done) - r.pool.delete(r.Tag) + r.pool.delete(r.tag) } // ReqPool is the pool of Reqs the server is dealing with. diff --git a/server.go b/server.go @@ -135,9 +135,9 @@ func (s *Server) runResponder(ctx context.Context, rp *ReqPool) { if !ok { return } - r.Ofcall.SetTag(r.Tag) + r.Ofcall.SetTag(r.tag) // free tag. - rp.delete(r.Tag) + rp.delete(r.tag) _, err := s.w.Write(r.Ofcall.marshal()) if err != nil { // TODO: handle error. @@ -179,7 +179,7 @@ func getReq(r io.Reader, rp *ReqPool, chatty bool) *Req { } return req } - req.Tag = ifcall.GetTag() + req.tag = ifcall.GetTag() req.Ifcall = ifcall req.done = make(chan struct{}) if ifcall, ok := req.Ifcall.(*TFlush); ok { diff --git a/server2_test.go b/server2_test.go @@ -80,7 +80,7 @@ func TestRunResponder(t *testing.T) { t.Fatalf("unmarshal %v", err) } s.respChan <- &Req{ - Tag: msg.GetTag(), + tag: msg.GetTag(), Ofcall: msg, } got := make([]byte, len(want)) @@ -118,8 +118,8 @@ func TestGetReq(t *testing.T) { if err != nil { t.Fatalf("recvmsg: %v", err) } - if got.Tag != wantMsg.GetTag() { - t.Errorf("r.Tag: want: %v, got: %v", wantMsg.GetTag(), got.Tag) + if got.tag != wantMsg.GetTag() { + t.Errorf("r.tag: want: %v, got: %v", wantMsg.GetTag(), got.tag) } if !reflect.DeepEqual(got.Ifcall, wantMsg) { t.Errorf("r.Ifcall:\n\twant: %v,\n\tgot: %v", wantMsg, got.Ifcall)