Comments (1)
Connect Packet contains the following fields:
https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901033
Field | Bytes | Note | async_mqtt member variable |
---|---|---|---|
FixedHeader | 1 | fixed_header_ | |
RemainingLength | 1-4 | variable | remaining_length_buf_ |
ProtocolName | 6 | 0x00,0x04,'M','Q','T','T' | protocol_name_and_level_ |
ProtocolVersion(Protocol Level in v3.1.1) | 1 | value is 5 | protocol_name_and_level_ |
ConnectFlags | 1 | connect_flags_ | |
KeepAlive | 2 | keep_alive_buf_ |
Subsequent packets are of variable length and/or optional. That makes memory gaps.
That is in common v3.1.1 and v5.
protocol_name_and_level_
already been unified. Because they are just checked on create but never access later.
The possible unification candidates are connect_flags_
and keep_alive_buf
. They are fixed size.
So if I unified them, The member woud be as follows:
Field | Bytes | Note | async_mqtt member variable |
---|---|---|---|
FixedHeader | 1 | fixed_header_ | |
RemainingLength | 1-4 | variable | remaining_length_buf_ |
ProtocolName | 6 | 0x00,0x04,'M','Q','T','T' | pn_pl_cf_ka_ |
ProtocolVersion(Protocol Level in v3.1.1) | 1 | value is 5 | pn_pl_cf_ka_ |
ConnectFlags | 1 | pn_pl_cf_ka_ | |
KeepAlive | 2 | pn_pl_cf_ka_ |
However, ConnectFlags are modified and referred in the packet member function frequently.
I can do it introducing reference or iteratoror index. But it would become a little complecated.
CONNECT packet is send only at the beggining of the session. So performance requirement is comparatively low. (I am not sure the unification could impact the performance)
Finally, I decided to remain the current code.
from async_mqtt.
Related Issues (20)
- Implementation details are too much exposed HOT 1
- standard library is type asliased. e.g. variant, any HOT 1
- Why async_mqtt::buffer is needed ? HOT 1
- Why strand is used by default. HOT 1
- How to write a test that checking associated properties well handled correctly. HOT 2
- bench wss mode memory error HOT 1
- Add doxygen comment to v5 publish packet HOT 1
- Doxygen document generation brokern HOT 1
- shared_ptr_array seems to confitional C++14 or C++17
- Free function document is not generated even if doxygen style commen is added HOT 1
- Support default completion token HOT 1
- Update document(ascii doc part) about multi threading HOT 1
- bind_executor should be done user's side if needed not in the library HOT 3
- Added C++ version requirement (C++17 or later) to the document HOT 1
- Refine document generation
- re-design error handling HOT 1
- Server Keep Alive override check HOT 1
- ASYNC_MQTT_SEPARATE_COMPILATION HOT 1
- Add get_endpoint() to client HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async_mqtt.