In write, buf_w was unchecked.
We already checked for room, so the buffer should have room. We make this a kind of assertion; this silences compiler warnings. Later, if this becomes a thread-level race condition, come back and actually use buf_w more meaningfully to handle partial writes.
This commit is contained in:
@@ -746,6 +746,11 @@ namespace ZeroTier {
|
||||
}
|
||||
|
||||
int buf_w = conn->TXbuf->write((const unsigned char*)data, len);
|
||||
if (buf_w != len) {
|
||||
// because we checked ZT_TCP_TX_BUF_SZ above, this should not happen
|
||||
DEBUG_ERROR("TX wrote only %d but expected to write %d", buf_w, len);
|
||||
exit(0);
|
||||
}
|
||||
//DEBUG_INFO("TXbuf->count() = %d", conn->TXbuf->count());
|
||||
int txsz = conn->TXbuf->count();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user