diff --git a/ReceiverThread.cpp b/ReceiverThread.cpp index 213a5fce..06bc5d91 100644 --- a/ReceiverThread.cpp +++ b/ReceiverThread.cpp @@ -747,6 +747,7 @@ ReceiverState ReceiverThread::sendDoneCmd() { if (socket_.write(buf_, 1) != 1) { PLOG(ERROR) << "unable to send DONE " << threadIndex_; doneSendFailure_ = true; + threadStats_.setErrorCode(SOCKET_WRITE_ERROR); return ACCEPT_WITH_TIMEOUT; } @@ -756,6 +757,7 @@ ReceiverState ReceiverThread::sendDoneCmd() { if (read != 1 || buf_[0] != Protocol::DONE_CMD) { LOG(ERROR) << *this << " did not receive ack for DONE"; doneSendFailure_ = true; + threadStats_.setErrorCode(SOCKET_READ_ERROR); return ACCEPT_WITH_TIMEOUT; } @@ -763,6 +765,7 @@ ReceiverState ReceiverThread::sendDoneCmd() { if (read != 0) { LOG(ERROR) << *this << " EOF not found where expected"; doneSendFailure_ = true; + threadStats_.setErrorCode(SOCKET_READ_ERROR); return ACCEPT_WITH_TIMEOUT; } socket_.closeCurrentConnection(); @@ -781,7 +784,7 @@ ReceiverState ReceiverThread::finishWithError() { auto guard = cv->acquire(); wdtParent_->addCheckpoint(checkpoint_); controller_->markState(threadIndex_, FINISHED); - // guard deletion notifies one thread + guard.notifyOne(); return END; } @@ -813,7 +816,7 @@ ReceiverState ReceiverThread::waitForFinishOrNewCheckpoint() { auto guard = cv->acquire(); auto state = checkForFinishOrNewCheckpoints(); if (state != WAIT_FOR_FINISH_OR_NEW_CHECKPOINT) { - // guard automatically notfies one + guard.notifyOne(); return state; } START_PERF_TIMER diff --git a/SenderThread.cpp b/SenderThread.cpp index 98ba5d71..3ef9c187 100644 --- a/SenderThread.cpp +++ b/SenderThread.cpp @@ -416,7 +416,6 @@ SenderState SenderThread::processDoneCmd() { SenderState SenderThread::processWaitCmd() { LOG(INFO) << *this << " entered PROCESS_WAIT_CMD state "; - ; ThreadTransferHistory &transferHistory = getTransferHistory(); VLOG(1) << "received WAIT_CMD, port " << port_; transferHistory.markAllAcknowledged(); diff --git a/util/ThreadsController.cpp b/util/ThreadsController.cpp index a11ebe5e..59a50a57 100644 --- a/util/ThreadsController.cpp +++ b/util/ThreadsController.cpp @@ -35,7 +35,6 @@ ConditionGuardImpl::~ConditionGuardImpl() { if (lock_ != nullptr) { delete lock_; } - cv_.notify_one(); } ConditionGuardImpl::ConditionGuardImpl(mutex &guardMutex,