diff --git a/client.go b/client.go index 4699a17..1b21671 100644 --- a/client.go +++ b/client.go @@ -16,10 +16,12 @@ var ( // Client is a asynchronous MQTT v3.1.1 client implementation which is // safe for concurrent use. type Client struct { - cs clientState - txlock sync.Mutex + cs clientState + rxlock sync.Mutex rx Rx + + txlock sync.Mutex tx Tx } diff --git a/rxtx.go b/rxtx.go index 98106a9..df610bb 100644 --- a/rxtx.go +++ b/rxtx.go @@ -18,19 +18,17 @@ import ( // // Not safe for concurrent use. type Rx struct { - // LastReceivedHeader contains the last correctly read header. - LastReceivedHeader Header // Transport over which packets are read and written to. // Not exported since RxTx type might be composed of embedded Rx and Tx types in future. TBD. rxTrp io.ReadCloser RxCallbacks RxCallbacks // User defined decoder for allocating packets. userDecoder Decoder - // Default decoder for non allocating packets. - dec DecoderNoAlloc // ScratchBuf is lazily allocated to exhaust Publish payloads when received and no // OnPub callback is set. ScratchBuf []byte + // LastReceivedHeader contains the last correctly read header. + LastReceivedHeader Header } // RxCallbacks groups all functionality executed on data receipt, both successful