예제 #1
0
파일: WdtSocket.cpp 프로젝트: Maascamp/wdt
ErrorCode WdtSocket::getNonRetryableErrCode() const {
  ErrorCode errCode = OK;
  if (readErrorCode_ != OK && readErrorCode_ != SOCKET_READ_ERROR &&
      readErrorCode_ != WDT_TIMEOUT) {
    errCode = getMoreInterestingError(errCode, readErrorCode_);
  }
  if (writeErrorCode_ != OK && writeErrorCode_ != SOCKET_WRITE_ERROR) {
    errCode = getMoreInterestingError(errCode, writeErrorCode_);
  }
  return errCode;
}
예제 #2
0
파일: Reporting.cpp 프로젝트: ffmpegd/wdt
TransferStats& TransferStats::operator+=(const TransferStats& stats) {
  folly::RWSpinLock::WriteHolder writeLock(mutex_.get());
  folly::RWSpinLock::ReadHolder readLock(stats.mutex_.get());
  headerBytes_ += stats.headerBytes_;
  dataBytes_ += stats.dataBytes_;
  effectiveHeaderBytes_ += stats.effectiveHeaderBytes_;
  effectiveDataBytes_ += stats.effectiveDataBytes_;
  numFiles_ += stats.numFiles_;
  numBlocks_ += stats.numBlocks_;
  failedAttempts_ += stats.failedAttempts_;
  if (numBlocksSend_ == -1) {
    numBlocksSend_ = stats.numBlocksSend_;
  } else if (stats.numBlocksSend_ != -1 &&
             numBlocksSend_ != stats.numBlocksSend_) {
    LOG_IF(ERROR, localErrCode_ == OK) << "Mismatch in the numBlocksSend "
                                       << numBlocksSend_ << " "
                                       << stats.numBlocksSend_;
    localErrCode_ = ERROR;
  }
  if (totalSenderBytes_ == -1) {
    totalSenderBytes_ = stats.totalSenderBytes_;
  } else if (stats.totalSenderBytes_ != -1 &&
             totalSenderBytes_ != stats.totalSenderBytes_) {
    LOG_IF(ERROR, localErrCode_ == OK) << "Mismatch in the total sender bytes "
                                       << totalSenderBytes_ << " "
                                       << stats.totalSenderBytes_;
    localErrCode_ = ERROR;
  }
  localErrCode_ = getMoreInterestingError(localErrCode_, stats.localErrCode_);
  VLOG(2) << "Local ErrorCode now " << localErrCode_ << " from "
          << stats.localErrCode_;
  remoteErrCode_ =
      getMoreInterestingError(remoteErrCode_, stats.remoteErrCode_);
  if (stats.localErrCode_ == OK && stats.remoteErrCode_ == OK) {
    // encryption type valid only if error code is OK
    // TODO: verify whether all successful threads have same encryption types
    encryptionType_ = stats.encryptionType_;
  }
  return *this;
}