diff --git a/receiver.go b/receiver.go index 6dbdcdd..7dfc515 100644 --- a/receiver.go +++ b/receiver.go @@ -23,10 +23,10 @@ func newReceiver(h handlerFunc, r io.Reader) *receiver { type receiver struct { wire io.Reader handle handlerFunc - deadline time.Duration + deadline time.Duration } -// Run continuously handles next packet until context is cancelled +// Run handles packets until context is cancelled func (r *receiver) Run(ctx context.Context) error { for { if err := ctx.Err(); err != nil { diff --git a/server_test.go b/server_test.go index acc2ceb..1ec346d 100644 --- a/server_test.go +++ b/server_test.go @@ -13,6 +13,12 @@ import ( "github.com/gregoryv/tt/ttx" ) +func TestServer_SetConnectTimeout(t *testing.T) { + srv := NewServer() + srv.SetConnectTimeout(0) +} + + func TestServer_SetDebugIncreasesLogging(t *testing.T) { srv := NewServer() l := log.New(ioutil.Discard, "", 0) diff --git a/srvcon.go b/srvcon.go index 0c3c8d5..9490d54 100644 --- a/srvcon.go +++ b/srvcon.go @@ -134,6 +134,7 @@ func (sc *sclient) receive(ctx context.Context, p mq.Packet) { a.SetAssignedClientID(sc.clientID) } _ = sc.transmit(ctx, a) + // todo respect connectTimeout case *mq.Subscribe: a := mq.NewSubAck()