helge
2021-11-06 9afb267cd98814efbae6eed15824ea8090758bb5
refs
用户 helge <helgewurst@web.de>
星期六, 十一月 6, 2021 07:05 +0800
提交者 helge <helgewurst@web.de>
星期六, 十一月 6, 2021 07:05 +0800
提交9afb267cd98814efbae6eed15824ea8090758bb5
目录 cc5638b1ad8efedac37536b96d8e9e07019497a7 目录 | zip | gz
parent b9c30cdba636faf528b4599b62628857303ef583 查看 | 对比
 bug fix: change netconn_write() argument from NETCONN_NOCOPY to NETCONN_COPY

Fix corrupted output when using chained queries and single queries with multiple return values. NETCONN_NOCOPY can only be used in cases like *IDN? where the buffer is const, which is used in tests and is probably why it hasn't been discovered.

netconn_write() documentation calling NETCONN_COPY "inefficient" may get people to generally avoid it, even if NETCONN_NOCOPY **cannot** be used, as is the case in SCPI_Write(). There would need to be a mechanism either for freeing buffers after use without copying, or one to ensure the corresponding tcp frame has been received by the client. Considering SCPI performance only really matters when low latency is key, or transfer of large amounts of block data is required - while at the same time the target has small amounts of memory and low performance - NETCONN_COPY is the obvious safe choice for this project.

"When passed the flag NETCONN_COPY the data is copied into internal buffers which are allocated for the data. This allows the data to be modified directly after the call, but is inefficient both in terms of execution time and memory usage. If the flag is not set then the data is not copied but rather referenced, and the NETCONN_NOCOPY manifest is provided for backwards compatibility. *The data must not be modified after the call*, since the data can be put on the retransmission queue for the connection, and stay there for an indeterminate amount of time."
1个文件已修改
4 ■■■■ 已修改文件
examples/test-LwIP-netconn/scpi_server.c 4 ●●●● 对比 | 查看 | 原始文档 | blame | 历史