mirror of https://github.com/aria2/aria2
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use format specifier %lld for cuid_t. Defined cuid_t as long long int instead of int64_t, since g++ complains int64_t is not suitable for %lld.pull/1/head
parent
694fb307aa
commit
03417e94b4
|
@ -1,3 +1,9 @@
|
|||
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Use format specifier %lld for cuid_t. Defined cuid_t as long long
|
||||
int instead of int64_t, since g++ complains int64_t is not
|
||||
suitable for %lld.
|
||||
|
||||
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Replaced StringFormat with fmt
|
||||
|
|
|
@ -113,8 +113,8 @@ AbstractCommand::~AbstractCommand() {
|
|||
}
|
||||
|
||||
bool AbstractCommand::execute() {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - socket: read:%d, write:%d, hup:%d, err:%d",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - socket: read:%d, write:%d, hup:%d, err:%d",
|
||||
getCuid(),
|
||||
readEventEnabled(),
|
||||
writeEventEnabled(),
|
||||
hupEventEnabled(),
|
||||
|
@ -124,9 +124,9 @@ bool AbstractCommand::execute() {
|
|||
return true;
|
||||
}
|
||||
if(req_ && req_->removalRequested()) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Discard original URI=%s because it is"
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Discard original URI=%s because it is"
|
||||
" requested.",
|
||||
util::itos(getCuid()).c_str(), req_->getUri().c_str()));
|
||||
getCuid(), req_->getUri().c_str()));
|
||||
return prepareForRetry(0);
|
||||
}
|
||||
if(getPieceStorage()) {
|
||||
|
@ -136,9 +136,9 @@ bool AbstractCommand::execute() {
|
|||
// This command previously has assigned segments, but it is
|
||||
// canceled. So discard current request chain. Plus, if no
|
||||
// segment is available when http pipelining is used.
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - It seems previously assigned segments"
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - It seems previously assigned segments"
|
||||
" are canceled. Restart.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
// Request::isPipeliningEnabled() == true means aria2
|
||||
// accessed the remote server and discovered that the server
|
||||
// supports pipelining.
|
||||
|
@ -153,8 +153,8 @@ bool AbstractCommand::execute() {
|
|||
!getPieceStorage()->hasMissingUnusedPiece()) {
|
||||
SharedHandle<Request> fasterRequest = fileEntry_->findFasterRequest(req_);
|
||||
if(fasterRequest) {
|
||||
A2_LOG_INFO(fmt("CUID#%s - Use faster Request hostname=%s, port=%u",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Use faster Request hostname=%s, port=%u",
|
||||
getCuid(),
|
||||
fasterRequest->getHost().c_str(),
|
||||
fasterRequest->getPort()));
|
||||
// Cancel current Request object and use faster one.
|
||||
|
@ -199,7 +199,7 @@ bool AbstractCommand::execute() {
|
|||
// enabled... Hmm, I don't think if pipelining is enabled
|
||||
// it does not go here.
|
||||
A2_LOG_INFO(fmt(MSG_NO_SEGMENT_AVAILABLE,
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
// When all segments are ignored in SegmentMan, there are
|
||||
// no URIs available, so don't retry.
|
||||
if(getSegmentMan()->allSegmentsIgnored()) {
|
||||
|
@ -234,17 +234,17 @@ bool AbstractCommand::execute() {
|
|||
req_->getProtocol());
|
||||
ss->setError();
|
||||
// Purging IP address cache to renew IP address.
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Marking IP address %s as bad",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Marking IP address %s as bad",
|
||||
getCuid(),
|
||||
req_->getConnectedAddr().c_str()));
|
||||
e_->markBadIPAddress(req_->getConnectedHostname(),
|
||||
req_->getConnectedAddr(),
|
||||
req_->getConnectedPort());
|
||||
if(e_->findCachedIPAddress
|
||||
(req_->getConnectedHostname(), req_->getConnectedPort()).empty()) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - All IP addresses were marked bad."
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - All IP addresses were marked bad."
|
||||
" Removing Entry.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
e_->removeCachedIPAddress
|
||||
(req_->getConnectedHostname(), req_->getConnectedPort());
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ bool AbstractCommand::execute() {
|
|||
A2_LOG_DEBUG_EX(EX_EXCEPTION_CAUGHT, err);
|
||||
} else {
|
||||
A2_LOG_ERROR_EX(fmt(MSG_DOWNLOAD_ABORTED,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
req_->getUri().c_str()),
|
||||
DL_ABORT_EX2(fmt("URI=%s", req_->getCurrentUri().c_str()),
|
||||
err));
|
||||
|
@ -274,7 +274,7 @@ bool AbstractCommand::execute() {
|
|||
} catch(DlRetryEx& err) {
|
||||
assert(req_);
|
||||
A2_LOG_INFO_EX(fmt(MSG_RESTARTING_DOWNLOAD,
|
||||
util::itos(getCuid()).c_str(), req_->getUri().c_str()),
|
||||
getCuid(), req_->getUri().c_str()),
|
||||
DL_RETRY_EX2(fmt("URI=%s", req_->getCurrentUri().c_str()),
|
||||
err));
|
||||
req_->addTryCount();
|
||||
|
@ -284,10 +284,10 @@ bool AbstractCommand::execute() {
|
|||
bool isAbort = maxTries != 0 && req_->getTryCount() >= maxTries;
|
||||
if(isAbort) {
|
||||
A2_LOG_INFO(fmt(MSG_MAX_TRY,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
req_->getTryCount()));
|
||||
A2_LOG_ERROR_EX(fmt(MSG_DOWNLOAD_ABORTED,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
req_->getUri().c_str()),
|
||||
err);
|
||||
fileEntry_->addURIResult(req_->getUri(), err.getCode());
|
||||
|
@ -320,15 +320,15 @@ void AbstractCommand::tryReserved() {
|
|||
// and there are no URI left. Because file length is unknown, we
|
||||
// can assume that there are no in-flight request object.
|
||||
if(entry->getLength() == 0 && entry->getRemainingUris().empty()) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Not trying next request."
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Not trying next request."
|
||||
" No reserved/pooled request is remaining and"
|
||||
" total length is still unknown.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Trying reserved/pooled request.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Trying reserved/pooled request.",
|
||||
getCuid()));
|
||||
std::vector<Command*> commands;
|
||||
requestGroup_->createNextCommand(commands, e_, 1);
|
||||
e_->setNoWait(true);
|
||||
|
@ -341,8 +341,8 @@ bool AbstractCommand::prepareForRetry(time_t wait) {
|
|||
}
|
||||
if(req_) {
|
||||
fileEntry_->poolRequest(req_);
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Pooling request URI=%s",
|
||||
util::itos(getCuid()).c_str(), req_->getUri().c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Pooling request URI=%s",
|
||||
getCuid(), req_->getUri().c_str()));
|
||||
if(getSegmentMan()) {
|
||||
getSegmentMan()->recognizeSegmentFor(fileEntry_);
|
||||
}
|
||||
|
@ -365,8 +365,8 @@ void AbstractCommand::onAbort() {
|
|||
fileEntry_->removeIdenticalURI(req_->getUri());
|
||||
fileEntry_->removeRequest(req_);
|
||||
}
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Aborting download",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Aborting download",
|
||||
getCuid()));
|
||||
if(getPieceStorage()) {
|
||||
getSegmentMan()->cancelSegment(getCuid());
|
||||
// Don't do following process if BitTorrent is involved or files
|
||||
|
@ -383,12 +383,12 @@ void AbstractCommand::onAbort() {
|
|||
// Local file exists, but given servers(or at least contacted
|
||||
// ones) doesn't support resume. Let's restart download from
|
||||
// scratch.
|
||||
A2_LOG_NOTICE(fmt("CUID#%s - Failed to resume download."
|
||||
A2_LOG_NOTICE(fmt("CUID#%lld - Failed to resume download."
|
||||
" Download from scratch.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Gathering URIs that has CANNOT_RESUME"
|
||||
getCuid()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Gathering URIs that has CANNOT_RESUME"
|
||||
" error",
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
// Set PREF_ALWAYS_RESUME to A2_V_TRUE to avoid repeating this
|
||||
// process.
|
||||
getOption()->put(PREF_ALWAYS_RESUME, A2_V_TRUE);
|
||||
|
@ -402,8 +402,8 @@ void AbstractCommand::onAbort() {
|
|||
uris.reserve(res.size());
|
||||
std::transform(res.begin(), res.end(), std::back_inserter(uris),
|
||||
std::mem_fun_ref(&URIResult::getURI));
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - %lu URIs found.",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - %lu URIs found.",
|
||||
getCuid(),
|
||||
static_cast<unsigned long int>(uris.size())));
|
||||
fileEntry_->addUris(uris.begin(), uris.end());
|
||||
getSegmentMan()->recognizeSegmentFor(fileEntry_);
|
||||
|
@ -605,10 +605,10 @@ SharedHandle<Request> AbstractCommand::createProxyRequest() const
|
|||
if(!proxy.empty()) {
|
||||
proxyRequest.reset(new Request());
|
||||
if(proxyRequest->setUri(proxy)) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Using proxy", util::itos(getCuid()).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Using proxy", getCuid()));
|
||||
} else {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Failed to parse proxy string",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Failed to parse proxy string",
|
||||
getCuid()));
|
||||
proxyRequest.reset();
|
||||
}
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ void AbstractCommand::initAsyncNameResolver(const std::string& hostname)
|
|||
}
|
||||
asyncNameResolver_.reset(new AsyncNameResolver(family));
|
||||
A2_LOG_INFO(fmt(MSG_RESOLVING_HOSTNAME,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
hostname.c_str()));
|
||||
asyncNameResolver_->resolve(hostname);
|
||||
setNameResolverCheck(asyncNameResolver_);
|
||||
|
@ -652,7 +652,7 @@ bool AbstractCommand::asyncResolveHostname()
|
|||
}
|
||||
throw DL_ABORT_EX
|
||||
(fmt(MSG_NAME_RESOLUTION_FAILED,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
asyncNameResolver_->getHostname().c_str(),
|
||||
asyncNameResolver_->getError().c_str()));
|
||||
default:
|
||||
|
@ -719,7 +719,7 @@ std::string AbstractCommand::resolveHostname
|
|||
res.resolve(addrs, hostname);
|
||||
}
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
hostname.c_str(),
|
||||
strjoin(addrs.begin(), addrs.end(), ", ").c_str()));
|
||||
for(std::vector<std::string>::const_iterator i = addrs.begin(),
|
||||
|
@ -730,7 +730,7 @@ std::string AbstractCommand::resolveHostname
|
|||
} else {
|
||||
ipaddr = addrs.front();
|
||||
A2_LOG_INFO(fmt(MSG_DNS_CACHE_HIT,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
hostname.c_str(),
|
||||
strjoin(addrs.begin(), addrs.end(), ", ").c_str()));
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ bool AbstractCommand::checkIfConnectionEstablished
|
|||
e_->markBadIPAddress(connectedHostname, connectedAddr, connectedPort);
|
||||
if(!e_->findCachedIPAddress(connectedHostname, connectedPort).empty()) {
|
||||
A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
connectedAddr.c_str(), connectedPort));
|
||||
Command* command =
|
||||
InitiateConnectionCommandFactory::createInitiateConnectionCommand
|
||||
|
|
|
@ -143,7 +143,7 @@ void ActivePeerConnectionCommand::connectToPeer(const SharedHandle<Peer>& peer)
|
|||
command->setPieceStorage(pieceStorage_);
|
||||
e_->addCommand(command);
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_PEER,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
peer->getIPAddress().c_str()));
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ void BtPieceMessage::doReceivedAction()
|
|||
SharedHandle<Piece> piece = getPieceStorage()->getPiece(index_);
|
||||
off_t offset = (off_t)index_*downloadContext_->getPieceLength()+begin_;
|
||||
A2_LOG_DEBUG(fmt(MSG_PIECE_RECEIVED,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
static_cast<unsigned long>(index_),
|
||||
begin_,
|
||||
blockLength_,
|
||||
|
@ -118,7 +118,7 @@ void BtPieceMessage::doReceivedAction()
|
|||
getPieceStorage()->getDiskAdaptor()->writeData
|
||||
(block_, blockLength_, offset);
|
||||
piece->completeBlock(slot.getBlockIndex());
|
||||
A2_LOG_DEBUG(fmt(MSG_PIECE_BITFIELD, util::itos(getCuid()).c_str(),
|
||||
A2_LOG_DEBUG(fmt(MSG_PIECE_BITFIELD, getCuid(),
|
||||
util::toHex(piece->getBitfield(),
|
||||
piece->getBitfieldLength()).c_str()));
|
||||
piece->updateHash(begin_, block_, blockLength_);
|
||||
|
@ -132,8 +132,8 @@ void BtPieceMessage::doReceivedAction()
|
|||
}
|
||||
}
|
||||
} else {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - RequestSlot not found, index=%lu, begin=%u",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - RequestSlot not found, index=%lu, begin=%u",
|
||||
getCuid(),
|
||||
static_cast<unsigned long>(index_),
|
||||
begin_));
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void BtPieceMessage::send()
|
|||
size_t writtenLength;
|
||||
if(!isSendingInProgress()) {
|
||||
A2_LOG_INFO(fmt(MSG_SEND_PEER_MESSAGE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
getPeer()->getIPAddress().c_str(),
|
||||
getPeer()->getPort(),
|
||||
toString().c_str()));
|
||||
|
@ -235,7 +235,7 @@ bool BtPieceMessage::checkPieceHash(const SharedHandle<Piece>& piece)
|
|||
void BtPieceMessage::onNewPiece(const SharedHandle<Piece>& piece)
|
||||
{
|
||||
A2_LOG_INFO(fmt(MSG_GOT_NEW_PIECE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
static_cast<unsigned long>(piece->getIndex())));
|
||||
getPieceStorage()->completePiece(piece);
|
||||
getPieceStorage()->advertisePiece(getCuid(), piece->getIndex());
|
||||
|
@ -244,7 +244,7 @@ void BtPieceMessage::onNewPiece(const SharedHandle<Piece>& piece)
|
|||
void BtPieceMessage::onWrongPiece(const SharedHandle<Piece>& piece)
|
||||
{
|
||||
A2_LOG_INFO(fmt(MSG_GOT_WRONG_PIECE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
static_cast<unsigned long>(piece->getIndex())));
|
||||
erasePieceOnDisk(piece);
|
||||
piece->clearAllBlock();
|
||||
|
@ -274,7 +274,7 @@ void BtPieceMessage::onChokingEvent(const BtChokingEvent& event)
|
|||
!isSendingInProgress() &&
|
||||
!getPeer()->isInAmAllowedIndexSet(index_)) {
|
||||
A2_LOG_DEBUG(fmt(MSG_REJECT_PIECE_CHOKED,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
static_cast<unsigned long>(index_),
|
||||
begin_,
|
||||
blockLength_));
|
||||
|
@ -297,7 +297,7 @@ void BtPieceMessage::onCancelSendingPieceEvent
|
|||
begin_ == event.getBegin() &&
|
||||
blockLength_ == event.getLength()) {
|
||||
A2_LOG_DEBUG(fmt(MSG_REJECT_PIECE_CANCEL,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
static_cast<unsigned long>(index_),
|
||||
begin_,
|
||||
blockLength_));
|
||||
|
|
|
@ -101,11 +101,11 @@ bool CheckIntegrityCommand::handleException(Exception& e)
|
|||
{
|
||||
getDownloadEngine()->getCheckIntegrityMan()->dropPickedEntry();
|
||||
A2_LOG_ERROR_EX(fmt(MSG_FILE_VALIDATION_FAILURE,
|
||||
util::itos(getCuid()).c_str()),
|
||||
getCuid()),
|
||||
e);
|
||||
A2_LOG_ERROR
|
||||
(fmt(MSG_DOWNLOAD_NOT_COMPLETE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
getRequestGroup()->getDownloadContext()->getBasePath().c_str()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ Command* CheckIntegrityDispatcherCommand::createCommand
|
|||
(const SharedHandle<CheckIntegrityEntry>& entry)
|
||||
{
|
||||
cuid_t newCUID = getDownloadEngine()->newCUID();
|
||||
A2_LOG_INFO(fmt("CUID#%s - Dispatching CheckIntegrityCommand CUID#%s.",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Dispatching CheckIntegrityCommand CUID#%s.",
|
||||
getCuid(),
|
||||
util::itos(newCUID).c_str()));
|
||||
return new CheckIntegrityCommand
|
||||
(newCUID, entry->getRequestGroup(), getDownloadEngine(), entry);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
namespace aria2 {
|
||||
|
||||
typedef int64_t cuid_t;
|
||||
typedef long long int cuid_t;
|
||||
|
||||
class Command {
|
||||
public:
|
||||
|
|
|
@ -165,14 +165,14 @@ bool DHTEntryPointNameResolveCommand::resolveHostname
|
|||
switch(resolver->getStatus()) {
|
||||
case AsyncNameResolver::STATUS_READY:
|
||||
A2_LOG_INFO(fmt(MSG_RESOLVING_HOSTNAME,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
hostname.c_str()));
|
||||
resolver->resolve(hostname);
|
||||
setNameResolverCheck(resolver);
|
||||
return false;
|
||||
case AsyncNameResolver::STATUS_SUCCESS:
|
||||
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
resolver->getHostname().c_str(),
|
||||
resolver->getResolvedAddresses().front().c_str()));
|
||||
return true;
|
||||
|
@ -180,7 +180,7 @@ bool DHTEntryPointNameResolveCommand::resolveHostname
|
|||
case AsyncNameResolver::STATUS_ERROR:
|
||||
throw DL_ABORT_EX
|
||||
(fmt(MSG_NAME_RESOLUTION_FAILED,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
hostname.c_str(),
|
||||
resolver->getError().c_str()));
|
||||
default:
|
||||
|
|
|
@ -117,8 +117,8 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
|
|||
if(memcmp(message->getPeerId(), bittorrent::getStaticPeerId(),
|
||||
PEER_ID_LENGTH) == 0) {
|
||||
throw DL_ABORT_EX
|
||||
(fmt("CUID#%s - Drop connection from the same Peer ID",
|
||||
util::itos(cuid_).c_str()));
|
||||
(fmt("CUID#%lld - Drop connection from the same Peer ID",
|
||||
cuid_));
|
||||
}
|
||||
std::vector<SharedHandle<Peer> > activePeers;
|
||||
peerStorage_->getActivePeers(activePeers);
|
||||
|
@ -126,8 +126,8 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
|
|||
eoi = activePeers.end(); i != eoi; ++i) {
|
||||
if(memcmp((*i)->getPeerId(), message->getPeerId(), PEER_ID_LENGTH) == 0) {
|
||||
throw DL_ABORT_EX
|
||||
(fmt("CUID#%s - Same Peer ID has been already seen.",
|
||||
util::itos(cuid_).c_str()));
|
||||
(fmt("CUID#%lld - Same Peer ID has been already seen.",
|
||||
cuid_));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,20 +135,20 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
|
|||
|
||||
if(message->isFastExtensionSupported()) {
|
||||
peer_->setFastExtensionEnabled(true);
|
||||
A2_LOG_INFO(fmt(MSG_FAST_EXTENSION_ENABLED, util::itos(cuid_).c_str()));
|
||||
A2_LOG_INFO(fmt(MSG_FAST_EXTENSION_ENABLED, cuid_));
|
||||
}
|
||||
if(message->isExtendedMessagingEnabled()) {
|
||||
peer_->setExtendedMessagingEnabled(true);
|
||||
if(!utPexEnabled_) {
|
||||
extensionMessageRegistry_->removeExtension("ut_pex");
|
||||
}
|
||||
A2_LOG_INFO(fmt(MSG_EXTENDED_MESSAGING_ENABLED, util::itos(cuid_).c_str()));
|
||||
A2_LOG_INFO(fmt(MSG_EXTENDED_MESSAGING_ENABLED, cuid_));
|
||||
}
|
||||
if(message->isDHTEnabled()) {
|
||||
peer_->setDHTEnabled(true);
|
||||
A2_LOG_INFO(fmt(MSG_DHT_ENABLED_PEER, util::itos(cuid_).c_str()));
|
||||
A2_LOG_INFO(fmt(MSG_DHT_ENABLED_PEER, cuid_));
|
||||
}
|
||||
A2_LOG_INFO(fmt(MSG_RECEIVE_PEER_MESSAGE, util::itos(cuid_).c_str(),
|
||||
A2_LOG_INFO(fmt(MSG_RECEIVE_PEER_MESSAGE, cuid_,
|
||||
peer_->getIPAddress().c_str(), peer_->getPort(),
|
||||
message->toString().c_str()));
|
||||
return message;
|
||||
|
@ -285,7 +285,7 @@ size_t DefaultBtInteractive::receiveMessages() {
|
|||
}
|
||||
++msgcount;
|
||||
A2_LOG_INFO(fmt(MSG_RECEIVE_PEER_MESSAGE,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
peer_->getIPAddress().c_str(), peer_->getPort(),
|
||||
message->toString().c_str()));
|
||||
message->doReceivedAction();
|
||||
|
@ -325,13 +325,13 @@ size_t DefaultBtInteractive::receiveMessages() {
|
|||
void DefaultBtInteractive::decideInterest() {
|
||||
if(pieceStorage_->hasMissingPiece(peer_)) {
|
||||
if(!peer_->amInterested()) {
|
||||
A2_LOG_DEBUG(fmt(MSG_PEER_INTERESTED, util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt(MSG_PEER_INTERESTED, cuid_));
|
||||
dispatcher_->
|
||||
addMessageToQueue(messageFactory_->createInterestedMessage());
|
||||
}
|
||||
} else {
|
||||
if(peer_->amInterested()) {
|
||||
A2_LOG_DEBUG(fmt(MSG_PEER_NOT_INTERESTED, util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt(MSG_PEER_NOT_INTERESTED, cuid_));
|
||||
dispatcher_->
|
||||
addMessageToQueue(messageFactory_->createNotInterestedMessage());
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
void operator()(const RequestSlot& slot) const
|
||||
{
|
||||
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
static_cast<unsigned long>(slot.getIndex()),
|
||||
slot.getBegin(),
|
||||
static_cast<unsigned long>(slot.getBlockIndex())));
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
{
|
||||
if(!peer_->isInPeerAllowedIndexSet(slot.getIndex())) {
|
||||
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_CHOKED,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
static_cast<unsigned long>(slot.getIndex()),
|
||||
slot.getBegin(),
|
||||
static_cast<unsigned long>(slot.getBlockIndex())));
|
||||
|
@ -283,7 +283,7 @@ public:
|
|||
{
|
||||
if(slot.isTimeout(requestTimeout_)) {
|
||||
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_TIMEOUT,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
static_cast<unsigned long>(slot.getIndex()),
|
||||
slot.getBegin(),
|
||||
static_cast<unsigned long>(slot.getBlockIndex())));
|
||||
|
@ -291,7 +291,7 @@ public:
|
|||
peer_->snubbing(true);
|
||||
} else if(slot.getPiece()->hasBlock(slot.getBlockIndex())) {
|
||||
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_ACQUIRED,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
static_cast<unsigned long>(slot.getIndex()),
|
||||
slot.getBegin(),
|
||||
static_cast<unsigned long>(slot.getBlockIndex())));
|
||||
|
|
|
@ -199,7 +199,7 @@ bool DownloadCommand::executeInternal() {
|
|||
// content length, but the client detected that download
|
||||
// completed.
|
||||
A2_LOG_INFO(fmt(MSG_SEGMENT_DOWNLOAD_COMPLETED,
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
|
||||
{
|
||||
|
|
|
@ -91,11 +91,11 @@ bool FileAllocationCommand::handleException(Exception& e)
|
|||
{
|
||||
getDownloadEngine()->getFileAllocationMan()->dropPickedEntry();
|
||||
A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE,
|
||||
util::itos(getCuid()).c_str()),
|
||||
getCuid()),
|
||||
e);
|
||||
A2_LOG_ERROR
|
||||
(fmt(MSG_DOWNLOAD_NOT_COMPLETE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
getRequestGroup()->getDownloadContext()->getBasePath().c_str()));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,14 +46,15 @@ namespace aria2 {
|
|||
FileAllocationDispatcherCommand::FileAllocationDispatcherCommand
|
||||
(cuid_t cuid,
|
||||
const SharedHandle<FileAllocationMan>& fileAllocMan,
|
||||
DownloadEngine* e):SequentialDispatcherCommand<FileAllocationEntry>
|
||||
(cuid, fileAllocMan, e) {}
|
||||
DownloadEngine* e)
|
||||
: SequentialDispatcherCommand<FileAllocationEntry>(cuid, fileAllocMan, e)
|
||||
{}
|
||||
|
||||
Command* FileAllocationDispatcherCommand::createCommand
|
||||
(const SharedHandle<FileAllocationEntry>& entry)
|
||||
{
|
||||
cuid_t newCUID = getDownloadEngine()->newCUID();
|
||||
A2_LOG_INFO(fmt(MSG_FILE_ALLOCATION_DISPATCH, util::itos(newCUID).c_str()));
|
||||
A2_LOG_INFO(fmt(MSG_FILE_ALLOCATION_DISPATCH, newCUID));
|
||||
FileAllocationCommand* command =
|
||||
new FileAllocationCommand(newCUID, entry->getRequestGroup(),
|
||||
getDownloadEngine(), entry);
|
||||
|
|
|
@ -87,7 +87,7 @@ bool FtpConnection::sendUser()
|
|||
request += authConfig_->getUser();
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), "USER ********"));
|
||||
cuid_, "USER ********"));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -101,7 +101,7 @@ bool FtpConnection::sendPass()
|
|||
request += authConfig_->getPassword();
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), "PASS ********"));
|
||||
cuid_, "PASS ********"));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -121,7 +121,7 @@ bool FtpConnection::sendType()
|
|||
request += type;
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(),request.c_str()));
|
||||
cuid_,request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -133,7 +133,7 @@ bool FtpConnection::sendPwd()
|
|||
if(socketBuffer_.sendBufferIsEmpty()) {
|
||||
std::string request = "PWD\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(),request.c_str()));
|
||||
cuid_,request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -147,7 +147,7 @@ bool FtpConnection::sendCwd(const std::string& dir)
|
|||
request += util::percentDecode(dir);
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(),request.c_str()));
|
||||
cuid_,request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -161,7 +161,7 @@ bool FtpConnection::sendMdtm()
|
|||
request += util::percentDecode(req_->getFile());
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -175,7 +175,7 @@ bool FtpConnection::sendSize()
|
|||
request += util::percentDecode(req_->getFile());
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -187,7 +187,7 @@ bool FtpConnection::sendEpsv()
|
|||
if(socketBuffer_.sendBufferIsEmpty()) {
|
||||
static const std::string request("EPSV\r\n");
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -199,7 +199,7 @@ bool FtpConnection::sendPasv()
|
|||
if(socketBuffer_.sendBufferIsEmpty()) {
|
||||
static const std::string request("PASV\r\n");
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -234,7 +234,7 @@ bool FtpConnection::sendEprt(const SharedHandle<SocketCore>& serverSocket)
|
|||
request += util::uitos(addrinfo.second);
|
||||
request += "|\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -264,7 +264,7 @@ bool FtpConnection::sendPort(const SharedHandle<SocketCore>& serverSocket)
|
|||
request += util::uitos(addrinfo.second%256);
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -282,7 +282,7 @@ bool FtpConnection::sendRest(const SharedHandle<Segment>& segment)
|
|||
}
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -296,7 +296,7 @@ bool FtpConnection::sendRetr()
|
|||
request += util::percentDecode(req_->getFile());
|
||||
request += "\r\n";
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(), request.c_str()));
|
||||
cuid_, request.c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
}
|
||||
socketBuffer_.send();
|
||||
|
@ -392,7 +392,7 @@ bool FtpConnection::bulkReceiveResponse
|
|||
response.first = status;
|
||||
response.second = strbuf_.substr(0, length);
|
||||
A2_LOG_INFO(fmt(MSG_RECEIVE_RESPONSE,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
response.second.c_str()));
|
||||
strbuf_.erase(0, length);
|
||||
return true;
|
||||
|
|
|
@ -91,20 +91,20 @@ bool FtpFinishDownloadCommand::execute()
|
|||
getSocket(), options);
|
||||
}
|
||||
} else {
|
||||
A2_LOG_INFO(fmt("CUID#%s - Bad status for transfer complete.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Bad status for transfer complete.",
|
||||
getCuid()));
|
||||
}
|
||||
} else if(getCheckPoint().difference(global::wallclock) >= getTimeout()) {
|
||||
A2_LOG_INFO(fmt("CUID#%s - Timeout before receiving transfer complete.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Timeout before receiving transfer complete.",
|
||||
getCuid()));
|
||||
} else {
|
||||
getDownloadEngine()->addCommand(this);
|
||||
return false;
|
||||
}
|
||||
} catch(RecoverableException& e) {
|
||||
A2_LOG_INFO_EX(fmt("CUID#%s - Exception was thrown, but download was"
|
||||
A2_LOG_INFO_EX(fmt("CUID#%lld - Exception was thrown, but download was"
|
||||
" finished, so we can ignore the exception.",
|
||||
util::itos(getCuid()).c_str()),
|
||||
getCuid()),
|
||||
e);
|
||||
}
|
||||
if(getRequestGroup()->downloadFinished()) {
|
||||
|
|
|
@ -91,7 +91,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
|||
}
|
||||
if(!pooledSocket) {
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(), addr.c_str(), port));
|
||||
getCuid(), addr.c_str(), port));
|
||||
createSocket();
|
||||
getSocket()->establishConnection(addr, port);
|
||||
|
||||
|
@ -154,7 +154,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
|||
(getRequest(), getOption().get())->getUser());
|
||||
if(!pooledSocket) {
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(), addr.c_str(), port));
|
||||
getCuid(), addr.c_str(), port));
|
||||
createSocket();
|
||||
getSocket()->establishConnection(addr, port);
|
||||
FtpNegotiationCommand* c =
|
||||
|
|
|
@ -254,8 +254,8 @@ bool FtpNegotiationCommand::recvPwd()
|
|||
throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status));
|
||||
}
|
||||
ftp_->setBaseWorkingDir(pwd);
|
||||
A2_LOG_INFO(fmt("CUID#%s - base working directory is '%s'",
|
||||
util::itos(getCuid()).c_str(), pwd.c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - base working directory is '%s'",
|
||||
getCuid(), pwd.c_str()));
|
||||
sequence_ = SEQ_SEND_CWD_PREP;
|
||||
return true;
|
||||
}
|
||||
|
@ -338,8 +338,8 @@ bool FtpNegotiationCommand::recvMdtm()
|
|||
" a time value as in specified in RFC3659.");
|
||||
}
|
||||
} else {
|
||||
A2_LOG_INFO(fmt("CUID#%s - MDTM command failed.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - MDTM command failed.",
|
||||
getCuid()));
|
||||
}
|
||||
sequence_ = SEQ_SEND_SIZE;
|
||||
return true;
|
||||
|
@ -474,8 +474,8 @@ bool FtpNegotiationCommand::recvSize() {
|
|||
}
|
||||
|
||||
} else {
|
||||
A2_LOG_INFO(fmt("CUID#%s - The remote FTP Server doesn't recognize SIZE"
|
||||
" command. Continue.", util::itos(getCuid()).c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - The remote FTP Server doesn't recognize SIZE"
|
||||
" command. Continue.", getCuid()));
|
||||
// Even if one of the other servers waiting in the queue supports SIZE
|
||||
// command, resuming and segmented downloading are disabled when the first
|
||||
// contacted FTP server doesn't support it.
|
||||
|
@ -639,7 +639,7 @@ bool FtpNegotiationCommand::preparePasvConnect() {
|
|||
} else {
|
||||
// make a data connection to the server.
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
dataConnAddr_.first.c_str(),
|
||||
dataConnAddr_.second));
|
||||
dataSocket_.reset(new SocketCore());
|
||||
|
@ -661,7 +661,7 @@ bool FtpNegotiationCommand::resolveProxy()
|
|||
return false;
|
||||
}
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
proxyAddr_.c_str(), proxyReq->getPort()));
|
||||
dataSocket_.reset(new SocketCore());
|
||||
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
|
||||
|
@ -691,11 +691,11 @@ bool FtpNegotiationCommand::sendTunnelRequest()
|
|||
error.c_str()));
|
||||
} else {
|
||||
A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
proxyAddr_.c_str(), proxyReq->getPort()));
|
||||
proxyAddr_ = nextProxyAddr;
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
proxyAddr_.c_str(), proxyReq->getPort()));
|
||||
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
|
||||
return false;
|
||||
|
|
|
@ -98,7 +98,7 @@ void HttpConnection::sendRequest(const SharedHandle<HttpRequest>& httpRequest)
|
|||
{
|
||||
std::string request = httpRequest->createRequest();
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
eraseConfidentialInfo(request).c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
socketBuffer_.send();
|
||||
|
@ -111,7 +111,7 @@ void HttpConnection::sendProxyRequest
|
|||
{
|
||||
std::string request = httpRequest->createProxyRequest();
|
||||
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
eraseConfidentialInfo(request).c_str()));
|
||||
socketBuffer_.pushStr(request);
|
||||
socketBuffer_.send();
|
||||
|
@ -146,7 +146,7 @@ SharedHandle<HttpResponse> HttpConnection::receiveResponse()
|
|||
size -= putbackDataLength;
|
||||
socket_->readData(buf, size);
|
||||
A2_LOG_INFO(fmt(MSG_RECEIVE_RESPONSE,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
proc->getHeaderString().c_str()));
|
||||
SharedHandle<HttpHeader> httpHeader = proc->getHttpResponseHeader();
|
||||
SharedHandle<HttpResponse> httpResponse(new HttpResponse());
|
||||
|
|
|
@ -78,7 +78,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand
|
|||
std::string proxyMethod = resolveProxyMethod(getRequest()->getProtocol());
|
||||
if(!pooledSocket) {
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(), addr.c_str(), port));
|
||||
getCuid(), addr.c_str(), port));
|
||||
createSocket();
|
||||
getSocket()->establishConnection(addr, port);
|
||||
|
||||
|
@ -131,7 +131,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand
|
|||
(resolvedAddresses, getRequest()->getPort());
|
||||
if(!pooledSocket) {
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(), addr.c_str(), port));
|
||||
getCuid(), addr.c_str(), port));
|
||||
createSocket();
|
||||
getSocket()->establishConnection(addr, port);
|
||||
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
||||
|
|
|
@ -85,7 +85,7 @@ bool HttpListenCommand::execute()
|
|||
e_->addCommand(c);
|
||||
}
|
||||
} catch(RecoverableException& e) {
|
||||
A2_LOG_DEBUG_EX(fmt(MSG_ACCEPT_FAILURE, util::itos(getCuid()).c_str()), e);
|
||||
A2_LOG_DEBUG_EX(fmt(MSG_ACCEPT_FAILURE, getCuid()), e);
|
||||
}
|
||||
e_->addCommand(this);
|
||||
return false;
|
||||
|
@ -97,8 +97,8 @@ bool HttpListenCommand::bindPort(uint16_t port)
|
|||
e_->deleteSocketForReadCheck(serverSocket_, this);
|
||||
}
|
||||
serverSocket_.reset(new SocketCore());
|
||||
A2_LOG_INFO(fmt("CUID#%s - Setting up HttpListenCommand for IPv%d",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Setting up HttpListenCommand for IPv%d",
|
||||
getCuid(),
|
||||
family_ == AF_INET?4:6));
|
||||
try {
|
||||
int flags = 0;
|
||||
|
@ -109,14 +109,14 @@ bool HttpListenCommand::bindPort(uint16_t port)
|
|||
serverSocket_->beginListen();
|
||||
serverSocket_->setNonBlockingMode();
|
||||
A2_LOG_INFO(fmt(MSG_LISTENING_PORT,
|
||||
util::itos(getCuid()).c_str(), port));
|
||||
getCuid(), port));
|
||||
e_->addSocketForReadCheck(serverSocket_, this);
|
||||
return true;
|
||||
} catch(RecoverableException& e) {
|
||||
A2_LOG_ERROR(fmt("Failed to setup XML-RPC server for IPv%d",
|
||||
family_ == AF_INET?4:6));
|
||||
A2_LOG_ERROR_EX(fmt(MSG_BIND_FAILURE,
|
||||
util::itos(getCuid()).c_str(), port),
|
||||
getCuid(), port),
|
||||
e);
|
||||
if(serverSocket_) {
|
||||
e_->deleteSocketForReadCheck(serverSocket_, this);
|
||||
|
|
|
@ -115,7 +115,7 @@ std::string HttpResponse::determinFilename() const
|
|||
}
|
||||
} else {
|
||||
A2_LOG_INFO(fmt(MSG_CONTENT_DISPOSITION_DETECTED,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
contentDisposition.c_str()));
|
||||
return contentDisposition;
|
||||
}
|
||||
|
@ -147,12 +147,12 @@ void HttpResponse::processRedirect()
|
|||
|
||||
if(httpRequest_->getRequest()->redirectUri(getRedirectURI())) {
|
||||
A2_LOG_INFO(fmt(MSG_REDIRECT,
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
httpRequest_->getRequest()->getCurrentUri().c_str()));
|
||||
} else {
|
||||
throw DL_RETRY_EX
|
||||
(fmt("CUID#%s - Redirect to %s failed. It may not be a valid URI.",
|
||||
util::itos(cuid_).c_str(),
|
||||
(fmt("CUID#%lld - Redirect to %s failed. It may not be a valid URI.",
|
||||
cuid_,
|
||||
httpRequest_->getRequest()->getCurrentUri().c_str()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,8 +119,8 @@ bool HttpServerBodyCommand::execute()
|
|||
}
|
||||
} catch(RecoverableException& e) {
|
||||
A2_LOG_INFO_EX
|
||||
(fmt("CUID#%s - Error occurred while reading HTTP request body",
|
||||
util::itos(getCuid()).c_str()),
|
||||
(fmt("CUID#%lld - Error occurred while reading HTTP request body",
|
||||
getCuid()),
|
||||
e);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -141,8 +141,8 @@ bool HttpServerCommand::execute()
|
|||
}
|
||||
}
|
||||
} catch(RecoverableException& e) {
|
||||
A2_LOG_INFO_EX(fmt("CUID#%s - Error occurred while reading HTTP request",
|
||||
util::itos(getCuid()).c_str()),
|
||||
A2_LOG_INFO_EX(fmt("CUID#%lld - Error occurred while reading HTTP request",
|
||||
getCuid()),
|
||||
e);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -75,26 +75,26 @@ bool HttpServerResponseCommand::execute()
|
|||
httpServer_->sendResponse();
|
||||
} catch(RecoverableException& e) {
|
||||
A2_LOG_INFO_EX
|
||||
(fmt("CUID#%s - Error occurred while transmitting response body.",
|
||||
util::itos(getCuid()).c_str()),
|
||||
(fmt("CUID#%lld - Error occurred while transmitting response body.",
|
||||
getCuid()),
|
||||
e);
|
||||
return true;
|
||||
}
|
||||
if(httpServer_->sendBufferIsEmpty()) {
|
||||
A2_LOG_INFO(fmt("CUID#%s - HttpServer: all response transmitted.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - HttpServer: all response transmitted.",
|
||||
getCuid()));
|
||||
if(httpServer_->supportsPersistentConnection()) {
|
||||
A2_LOG_INFO(fmt("CUID#%s - Persist connection.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Persist connection.",
|
||||
getCuid()));
|
||||
e_->addCommand
|
||||
(new HttpServerCommand(getCuid(), httpServer_, e_, socket_));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if(timeoutTimer_.difference(global::wallclock) >= 10) {
|
||||
A2_LOG_INFO(fmt("CUID#%s - HttpServer: Timeout while trasmitting"
|
||||
A2_LOG_INFO(fmt("CUID#%lld - HttpServer: Timeout while trasmitting"
|
||||
" response.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
return true;
|
||||
} else {
|
||||
e_->addCommand(this);
|
||||
|
|
|
@ -101,7 +101,7 @@ bool InitiateConnectionCommand::executeInternal() {
|
|||
if(!getDownloadEngine()->findCachedIPAddress(hostname, port).empty()) {
|
||||
A2_LOG_INFO_EX(EX_EXCEPTION_CAUGHT, ex);
|
||||
A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
ipaddr.c_str(), port));
|
||||
Command* command =
|
||||
InitiateConnectionCommandFactory::createInitiateConnectionCommand
|
||||
|
|
|
@ -173,9 +173,9 @@ bool InitiatorMSEHandshakeCommand::executeInternal() {
|
|||
bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
|
||||
{
|
||||
if(getOption()->getAsBool(PREF_BT_REQUIRE_CRYPTO)) {
|
||||
A2_LOG_INFO(fmt("CUID#%s - Establishing connection using legacy BitTorrent"
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Establishing connection using legacy BitTorrent"
|
||||
" handshake is disabled by preference.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
getCuid()));
|
||||
if(peerStorage_->isPeerAvailable() && btRuntime_->lessThanEqMinPeers()) {
|
||||
SharedHandle<Peer> peer = peerStorage_->getUnusedPeer();
|
||||
peer->usedBy(getDownloadEngine()->newCUID());
|
||||
|
@ -189,8 +189,8 @@ bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
|
|||
return true;
|
||||
} else {
|
||||
// try legacy BitTorrent handshake
|
||||
A2_LOG_INFO(fmt("CUID#%s - Retry using legacy BitTorrent handshake.",
|
||||
util::itos(getCuid()).c_str()));
|
||||
A2_LOG_INFO(fmt("CUID#%lld - Retry using legacy BitTorrent handshake.",
|
||||
getCuid()));
|
||||
PeerInitiateConnectionCommand* command =
|
||||
new PeerInitiateConnectionCommand(getCuid(), requestGroup_, getPeer(),
|
||||
getDownloadEngine(), btRuntime_, false);
|
||||
|
|
|
@ -106,12 +106,12 @@ MSEHandshake::HANDSHAKE_TYPE MSEHandshake::identifyHandshakeType()
|
|||
}
|
||||
if(rbuf_[0] == BtHandshakeMessage::PSTR_LENGTH &&
|
||||
memcmp(BtHandshakeMessage::BT_PSTR, rbuf_+1, 19) == 0) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - This is legacy BitTorrent handshake.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - This is legacy BitTorrent handshake.",
|
||||
cuid_));
|
||||
return HANDSHAKE_LEGACY;
|
||||
} else {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - This may be encrypted BitTorrent handshake.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - This may be encrypted BitTorrent handshake.",
|
||||
cuid_));
|
||||
return HANDSHAKE_ENCRYPTED;
|
||||
}
|
||||
}
|
||||
|
@ -122,15 +122,15 @@ void MSEHandshake::initEncryptionFacility(bool initiator)
|
|||
dh_ = new DHKeyExchange();
|
||||
dh_->init(PRIME, PRIME_BITS, GENERATOR, 160);
|
||||
dh_->generatePublicKey();
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - DH initialized.", util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - DH initialized.", cuid_));
|
||||
initiator_ = initiator;
|
||||
}
|
||||
|
||||
bool MSEHandshake::sendPublicKey()
|
||||
{
|
||||
if(socketBuffer_.sendBufferIsEmpty()) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Sending public key.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Sending public key.",
|
||||
cuid_));
|
||||
unsigned char buffer[KEY_LENGTH+MAX_PAD_LENGTH];
|
||||
dh_->getPublicKey(buffer, KEY_LENGTH);
|
||||
|
||||
|
@ -149,8 +149,8 @@ bool MSEHandshake::receivePublicKey()
|
|||
if(r > receiveNBytes(r)) {
|
||||
return false;
|
||||
}
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - public key received.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - public key received.",
|
||||
cuid_));
|
||||
// TODO handle exception. in catch, resbufLength = 0;
|
||||
dh_->computeSecret(secret_, sizeof(secret_), rbuf_, rbufLength_);
|
||||
// reset rbufLength_
|
||||
|
@ -254,8 +254,8 @@ uint16_t MSEHandshake::decodeLength16(const unsigned char* buffer)
|
|||
bool MSEHandshake::sendInitiatorStep2()
|
||||
{
|
||||
if(socketBuffer_.sendBufferIsEmpty()) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Sending negotiation step2.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Sending negotiation step2.",
|
||||
cuid_));
|
||||
unsigned char md[20];
|
||||
createReq1Hash(md);
|
||||
socketBuffer_.pushStr(std::string(&md[0], &md[sizeof(md)]));
|
||||
|
@ -341,8 +341,8 @@ bool MSEHandshake::findInitiatorVCMarker()
|
|||
size_t toRead = markerIndex_+VC_LENGTH-rbufLength_;
|
||||
socket_->readData(rbuf_+rbufLength_, toRead);
|
||||
rbufLength_ += toRead;
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - VC marker found at %lu",
|
||||
util::itos(cuid_).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - VC marker found at %lu",
|
||||
cuid_,
|
||||
static_cast<unsigned long>(markerIndex_)));
|
||||
verifyVC(rbuf_+markerIndex_);
|
||||
// reset rbufLength_
|
||||
|
@ -364,19 +364,19 @@ bool MSEHandshake::receiveInitiatorCryptoSelectAndPadDLength()
|
|||
rbufptr, sizeof(cryptoSelect));
|
||||
if(cryptoSelect[3]&CRYPTO_PLAIN_TEXT &&
|
||||
option_->get(PREF_BT_MIN_CRYPTO_LEVEL) == V_PLAIN) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - peer prefers plaintext.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - peer prefers plaintext.",
|
||||
cuid_));
|
||||
negotiatedCryptoType_ = CRYPTO_PLAIN_TEXT;
|
||||
}
|
||||
if(cryptoSelect[3]&CRYPTO_ARC4) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - peer prefers ARC4",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - peer prefers ARC4",
|
||||
cuid_));
|
||||
negotiatedCryptoType_ = CRYPTO_ARC4;
|
||||
}
|
||||
if(negotiatedCryptoType_ == CRYPTO_NONE) {
|
||||
throw DL_ABORT_EX
|
||||
(fmt("CUID#%s - No supported crypto type selected.",
|
||||
util::itos(cuid_).c_str()));
|
||||
(fmt("CUID#%lld - No supported crypto type selected.",
|
||||
cuid_));
|
||||
}
|
||||
}
|
||||
// padD length
|
||||
|
@ -437,8 +437,8 @@ bool MSEHandshake::findReceiverHashMarker()
|
|||
size_t toRead = markerIndex_+20-rbufLength_;
|
||||
socket_->readData(rbuf_+rbufLength_, toRead);
|
||||
rbufLength_ += toRead;
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Hash marker found at %lu.",
|
||||
util::itos(cuid_).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Hash marker found at %lu.",
|
||||
cuid_,
|
||||
static_cast<unsigned long>(markerIndex_)));
|
||||
verifyReq1Hash(rbuf_+markerIndex_);
|
||||
// reset rbufLength_
|
||||
|
@ -464,8 +464,8 @@ bool MSEHandshake::receiveReceiverHashAndPadCLength
|
|||
const unsigned char* infohash = bittorrent::getInfoHash(*i);
|
||||
createReq23Hash(md, infohash);
|
||||
if(memcmp(md, rbufptr, sizeof(md)) == 0) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - info hash found: %s",
|
||||
util::itos(cuid_).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - info hash found: %s",
|
||||
cuid_,
|
||||
util::toHex(infohash, INFO_HASH_LENGTH).c_str()));
|
||||
downloadContext = *i;
|
||||
break;
|
||||
|
@ -488,18 +488,18 @@ bool MSEHandshake::receiveReceiverHashAndPadCLength
|
|||
// For now, choose ARC4.
|
||||
if(cryptoProvide[3]&CRYPTO_PLAIN_TEXT &&
|
||||
option_->get(PREF_BT_MIN_CRYPTO_LEVEL) == V_PLAIN) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - peer provides plaintext.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - peer provides plaintext.",
|
||||
cuid_));
|
||||
negotiatedCryptoType_ = CRYPTO_PLAIN_TEXT;
|
||||
} else if(cryptoProvide[3]&CRYPTO_ARC4) {
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - peer provides ARC4.",
|
||||
util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - peer provides ARC4.",
|
||||
cuid_));
|
||||
negotiatedCryptoType_ = CRYPTO_ARC4;
|
||||
}
|
||||
if(negotiatedCryptoType_ == CRYPTO_NONE) {
|
||||
throw DL_ABORT_EX
|
||||
(fmt("CUID#%s - No supported crypto type provided.",
|
||||
util::itos(cuid_).c_str()));
|
||||
(fmt("CUID#%lld - No supported crypto type provided.",
|
||||
cuid_));
|
||||
}
|
||||
}
|
||||
// decrypt PadC length
|
||||
|
@ -518,8 +518,8 @@ bool MSEHandshake::receiveReceiverIALength()
|
|||
return false;
|
||||
}
|
||||
iaLength_ = decodeLength16(rbuf_);
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - len(IA)=%u.",
|
||||
util::itos(cuid_).c_str(), iaLength_));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - len(IA)=%u.",
|
||||
cuid_, iaLength_));
|
||||
// reset rbufLength_
|
||||
rbufLength_ = 0;
|
||||
return true;
|
||||
|
@ -537,7 +537,7 @@ bool MSEHandshake::receiveReceiverIA()
|
|||
delete [] ia_;
|
||||
ia_ = new unsigned char[iaLength_];
|
||||
decryptor_->decrypt(ia_, iaLength_, rbuf_, iaLength_);
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - IA received.", util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - IA received.", cuid_));
|
||||
// reset rbufLength_
|
||||
rbufLength_ = 0;
|
||||
return true;
|
||||
|
@ -576,11 +576,11 @@ bool MSEHandshake::sendReceiverStep2()
|
|||
|
||||
uint16_t MSEHandshake::verifyPadLength(const unsigned char* padlenbuf, const char* padName)
|
||||
{
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Verifying Pad length for %s",
|
||||
util::itos(cuid_).c_str(), padName));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Verifying Pad length for %s",
|
||||
cuid_, padName));
|
||||
uint16_t padLength = decodeLength16(padlenbuf);
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - len(%s)=%u",
|
||||
util::itos(cuid_).c_str(), padName, padLength));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - len(%s)=%u",
|
||||
cuid_, padName, padLength));
|
||||
if(padLength > 512) {
|
||||
throw DL_ABORT_EX
|
||||
(fmt("Too large %s length: %u", padName, padLength));
|
||||
|
@ -590,7 +590,7 @@ uint16_t MSEHandshake::verifyPadLength(const unsigned char* padlenbuf, const cha
|
|||
|
||||
void MSEHandshake::verifyVC(const unsigned char* vcbuf)
|
||||
{
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Verifying VC.", util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Verifying VC.", cuid_));
|
||||
unsigned char vc[VC_LENGTH];
|
||||
decryptor_->decrypt(vc, sizeof(vc), vcbuf, sizeof(vc));
|
||||
if(memcmp(VC, vc, sizeof(VC)) != 0) {
|
||||
|
@ -601,7 +601,7 @@ void MSEHandshake::verifyVC(const unsigned char* vcbuf)
|
|||
|
||||
void MSEHandshake::verifyReq1Hash(const unsigned char* req1buf)
|
||||
{
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Verifying req hash.", util::itos(cuid_).c_str()));
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Verifying req hash.", cuid_));
|
||||
unsigned char md[20];
|
||||
createReq1Hash(md);
|
||||
if(memcmp(md, req1buf, sizeof(md)) != 0) {
|
||||
|
|
|
@ -78,9 +78,9 @@ PeerAbstractCommand::~PeerAbstractCommand()
|
|||
|
||||
bool PeerAbstractCommand::execute()
|
||||
{
|
||||
A2_LOG_DEBUG(fmt("CUID#%s -"
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld -"
|
||||
" socket: read:%d, write:%d, hup:%d, err:%d, noCheck:%d",
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
readEventEnabled(), writeEventEnabled(),
|
||||
hupEventEnabled(), errorEventEnabled(),
|
||||
noCheck_));
|
||||
|
@ -110,10 +110,10 @@ bool PeerAbstractCommand::execute()
|
|||
return true;
|
||||
} catch(RecoverableException& err) {
|
||||
A2_LOG_DEBUG_EX(fmt(MSG_TORRENT_DOWNLOAD_ABORTED,
|
||||
util::itos(getCuid()).c_str()),
|
||||
getCuid()),
|
||||
err);
|
||||
A2_LOG_DEBUG(fmt(MSG_PEER_BANNED,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
peer_->getIPAddress().c_str(),
|
||||
peer_->getPort()));
|
||||
onAbort();
|
||||
|
|
|
@ -122,9 +122,9 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength) {
|
|||
return false;
|
||||
}
|
||||
// we got EOF
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - In PeerConnection::receiveMessage(),"
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - In PeerConnection::receiveMessage(),"
|
||||
" remain=%lu",
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
static_cast<unsigned long>(temp)));
|
||||
peer_->setDisconnectedGracefully(true);
|
||||
throw DL_ABORT_EX(EX_EOF_FROM_PEER);
|
||||
|
@ -155,9 +155,9 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength) {
|
|||
return false;
|
||||
}
|
||||
// we got EOF
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - In PeerConnection::receiveMessage(),"
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - In PeerConnection::receiveMessage(),"
|
||||
" payloadlen=%lu, remaining=%lu",
|
||||
util::itos(cuid_).c_str(),
|
||||
cuid_,
|
||||
static_cast<unsigned long>(currentPayloadLength_),
|
||||
static_cast<unsigned long>(temp)));
|
||||
peer_->setDisconnectedGracefully(true);
|
||||
|
@ -207,8 +207,8 @@ bool PeerConnection::receiveHandshake(unsigned char* data, size_t& dataLength,
|
|||
}
|
||||
// we got EOF
|
||||
A2_LOG_DEBUG
|
||||
(fmt("CUID#%s - In PeerConnection::receiveHandshake(), remain=%lu",
|
||||
util::itos(cuid_).c_str(),
|
||||
(fmt("CUID#%lld - In PeerConnection::receiveHandshake(), remain=%lu",
|
||||
cuid_,
|
||||
static_cast<unsigned long>(temp)));
|
||||
peer_->setDisconnectedGracefully(true);
|
||||
throw DL_ABORT_EX(EX_EOF_FROM_PEER);
|
||||
|
|
|
@ -77,7 +77,7 @@ PeerInitiateConnectionCommand::~PeerInitiateConnectionCommand()
|
|||
|
||||
bool PeerInitiateConnectionCommand::executeInternal() {
|
||||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
getPeer()->getIPAddress().c_str(),
|
||||
getPeer()->getPort()));
|
||||
createSocket();
|
||||
|
|
|
@ -98,7 +98,7 @@ bool PeerListenCommand::bindPort(uint16_t& port, IntSequence& seq)
|
|||
return true;
|
||||
} catch(RecoverableException& ex) {
|
||||
A2_LOG_ERROR_EX(fmt(MSG_BIND_FAILURE,
|
||||
util::itos(getCuid()).c_str(), port),
|
||||
getCuid(), port),
|
||||
ex);
|
||||
socket_->closeConnection();
|
||||
}
|
||||
|
@ -138,11 +138,11 @@ bool PeerListenCommand::execute() {
|
|||
A2_LOG_DEBUG(fmt("Accepted the connection from %s:%u.",
|
||||
peer->getIPAddress().c_str(),
|
||||
peer->getPort()));
|
||||
A2_LOG_DEBUG(fmt("Added CUID#%s to receive BitTorrent/MSE handshake.",
|
||||
util::itos(cuid).c_str()));
|
||||
A2_LOG_DEBUG(fmt("Added CUID#%lld to receive BitTorrent/MSE handshake.",
|
||||
cuid));
|
||||
} catch(RecoverableException& ex) {
|
||||
A2_LOG_DEBUG_EX(fmt(MSG_ACCEPT_FAILURE,
|
||||
util::itos(getCuid()).c_str()),
|
||||
getCuid()),
|
||||
ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ bool PeerReceiveHandshakeCommand::executeInternal()
|
|||
peerConnection_);
|
||||
getDownloadEngine()->addCommand(command);
|
||||
A2_LOG_DEBUG(fmt(MSG_INCOMING_PEER_CONNECTION,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
util::itos(getPeer()->usedBy()).c_str()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,9 +120,9 @@ SharedHandle<Segment> SegmentMan::checkoutSegment
|
|||
if(!piece) {
|
||||
return SharedHandle<Segment>();
|
||||
}
|
||||
A2_LOG_DEBUG(fmt("Attach segment#%lu to CUID#%s.",
|
||||
A2_LOG_DEBUG(fmt("Attach segment#%lu to CUID#%lld.",
|
||||
static_cast<unsigned long>(piece->getIndex()),
|
||||
util::itos(cuid).c_str()));
|
||||
cuid));
|
||||
SharedHandle<Segment> segment;
|
||||
if(piece->getLength() == 0) {
|
||||
segment.reset(new GrowSegment(piece));
|
||||
|
|
|
@ -56,7 +56,7 @@ void SimpleBtMessage::send() {
|
|||
}
|
||||
if(!isSendingInProgress()) {
|
||||
A2_LOG_INFO(fmt(MSG_SEND_PEER_MESSAGE,
|
||||
util::itos(getCuid()).c_str(),
|
||||
getCuid(),
|
||||
getPeer()->getIPAddress().c_str(),
|
||||
getPeer()->getPort(),
|
||||
toString().c_str()));
|
||||
|
|
|
@ -174,8 +174,8 @@ void TrackerWatcherCommand::processTrackerResponse
|
|||
command->setPeerStorage(peerStorage_);
|
||||
command->setPieceStorage(pieceStorage_);
|
||||
e_->addCommand(command);
|
||||
A2_LOG_DEBUG(fmt("CUID#%s - Adding new command CUID#%s",
|
||||
util::itos(getCuid()).c_str(),
|
||||
A2_LOG_DEBUG(fmt("CUID#%lld - Adding new command CUID#%s",
|
||||
getCuid(),
|
||||
util::itos(peer->usedBy()).c_str()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,70 +38,70 @@
|
|||
#include "common.h"
|
||||
|
||||
#define MSG_SEGMENT_DOWNLOAD_COMPLETED \
|
||||
"CUID#%s - The download for one segment completed successfully."
|
||||
#define MSG_NO_SEGMENT_AVAILABLE "CUID#%s - No segment available."
|
||||
#define MSG_CONNECTING_TO_SERVER "CUID#%s - Connecting to %s:%d"
|
||||
#define MSG_REDIRECT "CUID#%s - Redirecting to %s"
|
||||
#define MSG_SENDING_REQUEST "CUID#%s - Requesting:\n%s"
|
||||
#define MSG_RECEIVE_RESPONSE "CUID#%s - Response received:\n%s"
|
||||
#define MSG_DOWNLOAD_ABORTED "CUID#%s - Download aborted. URI=%s"
|
||||
#define MSG_RESTARTING_DOWNLOAD "CUID#%s - Restarting the download. URI=%s"
|
||||
#define MSG_TORRENT_DOWNLOAD_ABORTED "CUID#%s - Download aborted."
|
||||
"CUID#%lld - The download for one segment completed successfully."
|
||||
#define MSG_NO_SEGMENT_AVAILABLE "CUID#%lld - No segment available."
|
||||
#define MSG_CONNECTING_TO_SERVER "CUID#%lld - Connecting to %s:%d"
|
||||
#define MSG_REDIRECT "CUID#%lld - Redirecting to %s"
|
||||
#define MSG_SENDING_REQUEST "CUID#%lld - Requesting:\n%s"
|
||||
#define MSG_RECEIVE_RESPONSE "CUID#%lld - Response received:\n%s"
|
||||
#define MSG_DOWNLOAD_ABORTED "CUID#%lld - Download aborted. URI=%s"
|
||||
#define MSG_RESTARTING_DOWNLOAD "CUID#%lld - Restarting the download. URI=%s"
|
||||
#define MSG_TORRENT_DOWNLOAD_ABORTED "CUID#%lld - Download aborted."
|
||||
#define MSG_MAX_TRY \
|
||||
"CUID#%s - %d times attempted, but no success. Download aborted."
|
||||
#define MSG_SEND_PEER_MESSAGE "CUID#%s - To: %s:%d %s"
|
||||
#define MSG_RECEIVE_PEER_MESSAGE "CUID#%s - From: %s:%d %s"
|
||||
#define MSG_GOT_NEW_PIECE "CUID#%s - we got new piece. index=%lu"
|
||||
#define MSG_GOT_WRONG_PIECE "CUID#%s - we got wrong piece. index=%lu"
|
||||
#define MSG_DOWNLOAD_NOT_COMPLETE "CUID#%s - Download not complete: %s"
|
||||
"CUID#%lld - %d times attempted, but no success. Download aborted."
|
||||
#define MSG_SEND_PEER_MESSAGE "CUID#%lld - To: %s:%d %s"
|
||||
#define MSG_RECEIVE_PEER_MESSAGE "CUID#%lld - From: %s:%d %s"
|
||||
#define MSG_GOT_NEW_PIECE "CUID#%lld - we got new piece. index=%lu"
|
||||
#define MSG_GOT_WRONG_PIECE "CUID#%lld - we got wrong piece. index=%lu"
|
||||
#define MSG_DOWNLOAD_NOT_COMPLETE "CUID#%lld - Download not complete: %s"
|
||||
#define MSG_DOWNLOAD_ALREADY_COMPLETED _("GID#%s - Download has already completed: %s")
|
||||
#define MSG_RESOLVING_HOSTNAME "CUID#%s - Resolving hostname %s"
|
||||
#define MSG_RESOLVING_HOSTNAME "CUID#%lld - Resolving hostname %s"
|
||||
#define MSG_NAME_RESOLUTION_COMPLETE \
|
||||
"CUID#%s - Name resolution complete: %s -> %s"
|
||||
"CUID#%lld - Name resolution complete: %s -> %s"
|
||||
#define MSG_NAME_RESOLUTION_FAILED \
|
||||
"CUID#%s - Name resolution for %s failed:%s"
|
||||
#define MSG_DNS_CACHE_HIT "CUID#%s - DNS cache hit: %s -> %s"
|
||||
#define MSG_CONNECTING_TO_PEER "CUID#%s - Connecting to the peer %s"
|
||||
"CUID#%lld - Name resolution for %s failed:%s"
|
||||
#define MSG_DNS_CACHE_HIT "CUID#%lld - DNS cache hit: %s -> %s"
|
||||
#define MSG_CONNECTING_TO_PEER "CUID#%lld - Connecting to the peer %s"
|
||||
#define MSG_PIECE_RECEIVED \
|
||||
"CUID#%s - Piece received. index=%lu, begin=%u, length=%u, offset=%lld," \
|
||||
"CUID#%lld - Piece received. index=%lu, begin=%u, length=%u, offset=%lld," \
|
||||
" blockIndex=%lu"
|
||||
#define MSG_PIECE_BITFIELD "CUID#%s - Piece bitfield %s"
|
||||
#define MSG_PIECE_BITFIELD "CUID#%lld - Piece bitfield %s"
|
||||
#define MSG_REJECT_PIECE_CHOKED \
|
||||
"CUID#%s - Reject piece message in queue because the peer has been choked." \
|
||||
" index=%lu, begin=%u, length=%u"
|
||||
"CUID#%lld - Reject piece message in queue because the peer has been" \
|
||||
" choked. index=%lu, begin=%u, length=%u"
|
||||
#define MSG_REJECT_PIECE_CANCEL \
|
||||
"CUID#%s - Reject piece message in queue because cancel message received." \
|
||||
"CUID#%lld - Reject piece message in queue because cancel message received." \
|
||||
" index=%lu, begin=%u, length=%u"
|
||||
#define MSG_FILE_VALIDATION_FAILURE \
|
||||
"CUID#%s - Exception caught while validating file integrity."
|
||||
#define MSG_PEER_INTERESTED "CUID#%s - Interested in the peer"
|
||||
#define MSG_PEER_NOT_INTERESTED "CUID#%s - Not interested in the peer"
|
||||
#define MSG_DELETING_REQUEST_SLOT "CUID#%s - Deleting request slot index=%lu," \
|
||||
" begin=%u, blockIndex=%lu"
|
||||
#define MSG_DELETING_REQUEST_SLOT_CHOKED "CUID#%s - Deleting request slot" \
|
||||
"CUID#%lld - Exception caught while validating file integrity."
|
||||
#define MSG_PEER_INTERESTED "CUID#%lld - Interested in the peer"
|
||||
#define MSG_PEER_NOT_INTERESTED "CUID#%lld - Not interested in the peer"
|
||||
#define MSG_DELETING_REQUEST_SLOT "CUID#%lld - Deleting request slot" \
|
||||
" index=%lu, begin=%u, blockIndex=%lu"
|
||||
#define MSG_DELETING_REQUEST_SLOT_CHOKED "CUID#%lld - Deleting request slot" \
|
||||
" index=%lu, begin=%u, blockIndex=%lu because localhost got choked."
|
||||
#define MSG_DELETING_REQUEST_SLOT_TIMEOUT "CUID#%s - Deleting request slot" \
|
||||
#define MSG_DELETING_REQUEST_SLOT_TIMEOUT "CUID#%lld - Deleting request slot" \
|
||||
" index=%lu, begin=%u, blockIndex=%lu because of time out"
|
||||
#define MSG_DELETING_REQUEST_SLOT_ACQUIRED "CUID#%s - Deleting request slot" \
|
||||
#define MSG_DELETING_REQUEST_SLOT_ACQUIRED "CUID#%lld - Deleting request slot" \
|
||||
" index=%lu, begin=%u, blockIndex=%lu because the block has been acquired."
|
||||
#define MSG_FAST_EXTENSION_ENABLED "CUID#%s - Fast extension enabled."
|
||||
#define MSG_EXTENDED_MESSAGING_ENABLED "CUID#%s - Extended Messaging enabled."
|
||||
#define MSG_FAST_EXTENSION_ENABLED "CUID#%lld - Fast extension enabled."
|
||||
#define MSG_EXTENDED_MESSAGING_ENABLED "CUID#%lld - Extended Messaging enabled."
|
||||
#define MSG_FILE_ALLOCATION_FAILURE \
|
||||
"CUID#%s - Exception caught while allocating file space."
|
||||
"CUID#%lld - Exception caught while allocating file space."
|
||||
#define MSG_CONTENT_DISPOSITION_DETECTED \
|
||||
"CUID#%s - Content-Disposition detected. Use %s as filename"
|
||||
#define MSG_PEER_BANNED "CUID#%s - Peer %s:%d banned."
|
||||
"CUID#%lld - Content-Disposition detected. Use %s as filename"
|
||||
#define MSG_PEER_BANNED "CUID#%lld - Peer %s:%d banned."
|
||||
#define MSG_LISTENING_PORT \
|
||||
"CUID#%s - Using port %d for accepting new connections"
|
||||
#define MSG_BIND_FAILURE "CUID#%s - An error occurred while binding port=%d"
|
||||
"CUID#%lld - Using port %d for accepting new connections"
|
||||
#define MSG_BIND_FAILURE "CUID#%lld - An error occurred while binding port=%d"
|
||||
#define MSG_INCOMING_PEER_CONNECTION \
|
||||
"CUID#%s - Incoming connection, adding new command CUID#%s"
|
||||
#define MSG_ACCEPT_FAILURE "CUID#%s - Error in accepting connection"
|
||||
"CUID#%lld - Incoming connection, adding new command CUID#%s"
|
||||
#define MSG_ACCEPT_FAILURE "CUID#%lld - Error in accepting connection"
|
||||
#define MSG_TRACKER_RESPONSE_PROCESSING_FAILED \
|
||||
"CUID#%s - Error occurred while processing tracker response."
|
||||
#define MSG_DHT_ENABLED_PEER "CUID#%s - The peer is DHT-enabled."
|
||||
"CUID#%lld - Error occurred while processing tracker response."
|
||||
#define MSG_DHT_ENABLED_PEER "CUID#%lld - The peer is DHT-enabled."
|
||||
#define MSG_CONNECT_FAILED_AND_RETRY \
|
||||
"CUID#%s - Could not to connect to %s:%u. Trying another address"
|
||||
"CUID#%lld - Could not to connect to %s:%u. Trying another address"
|
||||
|
||||
#define MSG_UNRECOGNIZED_URI _("Unrecognized URI or unsupported protocol: %s")
|
||||
#define MSG_TRACKER_WARNING_MESSAGE _("Tracker returned warning message: %s")
|
||||
|
@ -127,7 +127,7 @@
|
|||
#define MSG_VALIDATING_FILE _("Validating file %s")
|
||||
#define MSG_ALLOCATION_COMPLETED _("%ld seconds to allocate %s byte(s)")
|
||||
#define MSG_FILE_ALLOCATION_DISPATCH \
|
||||
"Dispatching FileAllocationCommand for CUID#%s."
|
||||
"Dispatching FileAllocationCommand for CUID#%lld."
|
||||
#define MSG_METALINK_QUEUEING _("Metalink: Queueing %s for download.")
|
||||
#define MSG_FILE_DOWNLOAD_COMPLETED _("Download complete: %s")
|
||||
#define MSG_SEEDING_END _("Seeding is over.")
|
||||
|
|
Loading…
Reference in New Issue