This commit is contained in:
J. Nick Koston
2025-05-15 12:52:25 -05:00
parent 488dc40f2e
commit 31f5bbf623

View File

@@ -299,15 +299,8 @@ APIError APINoiseFrameHelper::try_read_frame_(ParsedFrame *frame) {
}
// Only check for available data when starting a new frame read
if (rx_header_buf_len_ == 0) {
ssize_t available = socket_->available();
if (available == 0) {
return APIError::WOULD_BLOCK;
} else if (available == -1) {
state_ = State::FAILED;
HELPER_LOG("Socket available failed with errno %d", errno);
return APIError::SOCKET_READ_FAILED;
}
if (rx_header_buf_len_ == 0 && socket_->available() == 0) {
return APIError::WOULD_BLOCK;
}
// read header
@@ -828,15 +821,8 @@ APIError APIPlaintextFrameHelper::try_read_frame_(ParsedFrame *frame) {
}
// Only check for available data when starting a new frame read
if (rx_header_buf_pos_ == 0) {
ssize_t available = socket_->available();
if (available == 0) {
return APIError::WOULD_BLOCK;
} else if (available == -1) {
state_ = State::FAILED;
HELPER_LOG("Socket read_available failed with errno %d", errno);
return APIError::SOCKET_READ_FAILED;
}
if (rx_header_buf_pos_ == 0 && socket_->available() == 0) {
return APIError::WOULD_BLOCK;
}
// read header