Merge pull request #632 from smarsching/xvc-client-performance

Performance improvement for XVC client
This commit is contained in:
Gwenhael Goavec-Merou 2026-03-05 17:00:21 +01:00 committed by GitHub
commit 4ab6f220b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 10 deletions

View File

@ -267,20 +267,16 @@ ssize_t XVC_client::xfer_pkt(const string &instr,
uint8_t *rx, uint32_t rx_size)
{
ssize_t len = tx_size;
vector<uint8_t> buffer(instr.size() + (tx) ? tx_size : 0);
memcpy(buffer.data(), instr.c_str(), instr.size());
if (tx)
memcpy(buffer.data() + instr.size(), tx, tx_size);
/* 1. instruction */
if (sendall(_sock, instr.c_str(), instr.size(), 0) == -1) {
printError("Send instruction failed");
if (sendall(_sock, buffer.data(), buffer.size(), 0) == -1) {
printError("Send failed");
return -1;
}
if (tx) {
if (sendall(_sock, tx, tx_size, 0) == -1) {
printError("Send error");
return -1;
}
}
if (rx) {
len = recv(_sock, rx, rx_size, 0);
if (len < 0) {