in SenderThread.cpp [108:149]
SenderState SenderThread::connect() {
WTVLOG(1) << "entered CONNECT state";
if (socket_) {
ErrorCode socketErrCode = socket_->getNonRetryableErrCode();
if (socketErrCode != OK) {
WTLOG(ERROR) << "Socket has non-retryable error "
<< errorCodeToStr(socketErrCode);
threadStats_.setLocalErrorCode(socketErrCode);
return END;
}
socket_->closeNoCheck();
}
if (numReconnectWithoutProgress_ >= options_.max_transfer_retries) {
WTLOG(ERROR) << "Sender thread reconnected " << numReconnectWithoutProgress_
<< " times without making any progress, giving up. port: "
<< socket_->getPort();
threadStats_.setLocalErrorCode(NO_PROGRESS);
return END;
}
ErrorCode code;
// TODO cleanup more but for now avoid having 2 socket object live per port
socket_ = nullptr;
socket_ = connectToReceiver(port_, threadCtx_->getAbortChecker(), code);
if (code == ABORT) {
threadStats_.setLocalErrorCode(ABORT);
if (getThreadAbortCode() == VERSION_MISMATCH) {
return PROCESS_VERSION_MISMATCH;
}
return END;
}
if (code != OK) {
threadStats_.setLocalErrorCode(code);
return END;
}
auto nextState = SEND_SETTINGS;
if (threadStats_.getLocalErrorCode() != OK) {
nextState = READ_LOCAL_CHECKPOINT;
}
// resetting the status of thread
reset();
return nextState;
}