Merge pull request #632 from smarsching/xvc-client-performance
Performance improvement for XVC client
This commit is contained in:
commit
4ab6f220b9
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue