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
Tatsuhiro Tsujikawa 2010-11-20 12:12:06 +00:00
parent 694fb307aa
commit 03417e94b4
36 changed files with 253 additions and 246 deletions

View File

@ -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> 2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced StringFormat with fmt Replaced StringFormat with fmt

View File

@ -113,8 +113,8 @@ AbstractCommand::~AbstractCommand() {
} }
bool AbstractCommand::execute() { bool AbstractCommand::execute() {
A2_LOG_DEBUG(fmt("CUID#%s - socket: read:%d, write:%d, hup:%d, err:%d", A2_LOG_DEBUG(fmt("CUID#%lld - socket: read:%d, write:%d, hup:%d, err:%d",
util::itos(getCuid()).c_str(), getCuid(),
readEventEnabled(), readEventEnabled(),
writeEventEnabled(), writeEventEnabled(),
hupEventEnabled(), hupEventEnabled(),
@ -124,9 +124,9 @@ bool AbstractCommand::execute() {
return true; return true;
} }
if(req_ && req_->removalRequested()) { 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.", " requested.",
util::itos(getCuid()).c_str(), req_->getUri().c_str())); getCuid(), req_->getUri().c_str()));
return prepareForRetry(0); return prepareForRetry(0);
} }
if(getPieceStorage()) { if(getPieceStorage()) {
@ -136,9 +136,9 @@ bool AbstractCommand::execute() {
// This command previously has assigned segments, but it is // This command previously has assigned segments, but it is
// canceled. So discard current request chain. Plus, if no // canceled. So discard current request chain. Plus, if no
// segment is available when http pipelining is used. // 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.", " are canceled. Restart.",
util::itos(getCuid()).c_str())); getCuid()));
// Request::isPipeliningEnabled() == true means aria2 // Request::isPipeliningEnabled() == true means aria2
// accessed the remote server and discovered that the server // accessed the remote server and discovered that the server
// supports pipelining. // supports pipelining.
@ -153,8 +153,8 @@ bool AbstractCommand::execute() {
!getPieceStorage()->hasMissingUnusedPiece()) { !getPieceStorage()->hasMissingUnusedPiece()) {
SharedHandle<Request> fasterRequest = fileEntry_->findFasterRequest(req_); SharedHandle<Request> fasterRequest = fileEntry_->findFasterRequest(req_);
if(fasterRequest) { if(fasterRequest) {
A2_LOG_INFO(fmt("CUID#%s - Use faster Request hostname=%s, port=%u", A2_LOG_INFO(fmt("CUID#%lld - Use faster Request hostname=%s, port=%u",
util::itos(getCuid()).c_str(), getCuid(),
fasterRequest->getHost().c_str(), fasterRequest->getHost().c_str(),
fasterRequest->getPort())); fasterRequest->getPort()));
// Cancel current Request object and use faster one. // 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 // enabled... Hmm, I don't think if pipelining is enabled
// it does not go here. // it does not go here.
A2_LOG_INFO(fmt(MSG_NO_SEGMENT_AVAILABLE, A2_LOG_INFO(fmt(MSG_NO_SEGMENT_AVAILABLE,
util::itos(getCuid()).c_str())); getCuid()));
// When all segments are ignored in SegmentMan, there are // When all segments are ignored in SegmentMan, there are
// no URIs available, so don't retry. // no URIs available, so don't retry.
if(getSegmentMan()->allSegmentsIgnored()) { if(getSegmentMan()->allSegmentsIgnored()) {
@ -234,17 +234,17 @@ bool AbstractCommand::execute() {
req_->getProtocol()); req_->getProtocol());
ss->setError(); ss->setError();
// Purging IP address cache to renew IP address. // Purging IP address cache to renew IP address.
A2_LOG_DEBUG(fmt("CUID#%s - Marking IP address %s as bad", A2_LOG_DEBUG(fmt("CUID#%lld - Marking IP address %s as bad",
util::itos(getCuid()).c_str(), getCuid(),
req_->getConnectedAddr().c_str())); req_->getConnectedAddr().c_str()));
e_->markBadIPAddress(req_->getConnectedHostname(), e_->markBadIPAddress(req_->getConnectedHostname(),
req_->getConnectedAddr(), req_->getConnectedAddr(),
req_->getConnectedPort()); req_->getConnectedPort());
if(e_->findCachedIPAddress if(e_->findCachedIPAddress
(req_->getConnectedHostname(), req_->getConnectedPort()).empty()) { (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.", " Removing Entry.",
util::itos(getCuid()).c_str())); getCuid()));
e_->removeCachedIPAddress e_->removeCachedIPAddress
(req_->getConnectedHostname(), req_->getConnectedPort()); (req_->getConnectedHostname(), req_->getConnectedPort());
} }
@ -258,7 +258,7 @@ bool AbstractCommand::execute() {
A2_LOG_DEBUG_EX(EX_EXCEPTION_CAUGHT, err); A2_LOG_DEBUG_EX(EX_EXCEPTION_CAUGHT, err);
} else { } else {
A2_LOG_ERROR_EX(fmt(MSG_DOWNLOAD_ABORTED, A2_LOG_ERROR_EX(fmt(MSG_DOWNLOAD_ABORTED,
util::itos(getCuid()).c_str(), getCuid(),
req_->getUri().c_str()), req_->getUri().c_str()),
DL_ABORT_EX2(fmt("URI=%s", req_->getCurrentUri().c_str()), DL_ABORT_EX2(fmt("URI=%s", req_->getCurrentUri().c_str()),
err)); err));
@ -274,7 +274,7 @@ bool AbstractCommand::execute() {
} catch(DlRetryEx& err) { } catch(DlRetryEx& err) {
assert(req_); assert(req_);
A2_LOG_INFO_EX(fmt(MSG_RESTARTING_DOWNLOAD, 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()), DL_RETRY_EX2(fmt("URI=%s", req_->getCurrentUri().c_str()),
err)); err));
req_->addTryCount(); req_->addTryCount();
@ -284,10 +284,10 @@ bool AbstractCommand::execute() {
bool isAbort = maxTries != 0 && req_->getTryCount() >= maxTries; bool isAbort = maxTries != 0 && req_->getTryCount() >= maxTries;
if(isAbort) { if(isAbort) {
A2_LOG_INFO(fmt(MSG_MAX_TRY, A2_LOG_INFO(fmt(MSG_MAX_TRY,
util::itos(getCuid()).c_str(), getCuid(),
req_->getTryCount())); req_->getTryCount()));
A2_LOG_ERROR_EX(fmt(MSG_DOWNLOAD_ABORTED, A2_LOG_ERROR_EX(fmt(MSG_DOWNLOAD_ABORTED,
util::itos(getCuid()).c_str(), getCuid(),
req_->getUri().c_str()), req_->getUri().c_str()),
err); err);
fileEntry_->addURIResult(req_->getUri(), err.getCode()); 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 // and there are no URI left. Because file length is unknown, we
// can assume that there are no in-flight request object. // can assume that there are no in-flight request object.
if(entry->getLength() == 0 && entry->getRemainingUris().empty()) { 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" " No reserved/pooled request is remaining and"
" total length is still unknown.", " total length is still unknown.",
util::itos(getCuid()).c_str())); getCuid()));
return; return;
} }
} }
A2_LOG_DEBUG(fmt("CUID#%s - Trying reserved/pooled request.", A2_LOG_DEBUG(fmt("CUID#%lld - Trying reserved/pooled request.",
util::itos(getCuid()).c_str())); getCuid()));
std::vector<Command*> commands; std::vector<Command*> commands;
requestGroup_->createNextCommand(commands, e_, 1); requestGroup_->createNextCommand(commands, e_, 1);
e_->setNoWait(true); e_->setNoWait(true);
@ -341,8 +341,8 @@ bool AbstractCommand::prepareForRetry(time_t wait) {
} }
if(req_) { if(req_) {
fileEntry_->poolRequest(req_); fileEntry_->poolRequest(req_);
A2_LOG_DEBUG(fmt("CUID#%s - Pooling request URI=%s", A2_LOG_DEBUG(fmt("CUID#%lld - Pooling request URI=%s",
util::itos(getCuid()).c_str(), req_->getUri().c_str())); getCuid(), req_->getUri().c_str()));
if(getSegmentMan()) { if(getSegmentMan()) {
getSegmentMan()->recognizeSegmentFor(fileEntry_); getSegmentMan()->recognizeSegmentFor(fileEntry_);
} }
@ -365,8 +365,8 @@ void AbstractCommand::onAbort() {
fileEntry_->removeIdenticalURI(req_->getUri()); fileEntry_->removeIdenticalURI(req_->getUri());
fileEntry_->removeRequest(req_); fileEntry_->removeRequest(req_);
} }
A2_LOG_DEBUG(fmt("CUID#%s - Aborting download", A2_LOG_DEBUG(fmt("CUID#%lld - Aborting download",
util::itos(getCuid()).c_str())); getCuid()));
if(getPieceStorage()) { if(getPieceStorage()) {
getSegmentMan()->cancelSegment(getCuid()); getSegmentMan()->cancelSegment(getCuid());
// Don't do following process if BitTorrent is involved or files // 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 // Local file exists, but given servers(or at least contacted
// ones) doesn't support resume. Let's restart download from // ones) doesn't support resume. Let's restart download from
// scratch. // scratch.
A2_LOG_NOTICE(fmt("CUID#%s - Failed to resume download." A2_LOG_NOTICE(fmt("CUID#%lld - Failed to resume download."
" Download from scratch.", " Download from scratch.",
util::itos(getCuid()).c_str())); getCuid()));
A2_LOG_DEBUG(fmt("CUID#%s - Gathering URIs that has CANNOT_RESUME" A2_LOG_DEBUG(fmt("CUID#%lld - Gathering URIs that has CANNOT_RESUME"
" error", " error",
util::itos(getCuid()).c_str())); getCuid()));
// Set PREF_ALWAYS_RESUME to A2_V_TRUE to avoid repeating this // Set PREF_ALWAYS_RESUME to A2_V_TRUE to avoid repeating this
// process. // process.
getOption()->put(PREF_ALWAYS_RESUME, A2_V_TRUE); getOption()->put(PREF_ALWAYS_RESUME, A2_V_TRUE);
@ -402,8 +402,8 @@ void AbstractCommand::onAbort() {
uris.reserve(res.size()); uris.reserve(res.size());
std::transform(res.begin(), res.end(), std::back_inserter(uris), std::transform(res.begin(), res.end(), std::back_inserter(uris),
std::mem_fun_ref(&URIResult::getURI)); std::mem_fun_ref(&URIResult::getURI));
A2_LOG_DEBUG(fmt("CUID#%s - %lu URIs found.", A2_LOG_DEBUG(fmt("CUID#%lld - %lu URIs found.",
util::itos(getCuid()).c_str(), getCuid(),
static_cast<unsigned long int>(uris.size()))); static_cast<unsigned long int>(uris.size())));
fileEntry_->addUris(uris.begin(), uris.end()); fileEntry_->addUris(uris.begin(), uris.end());
getSegmentMan()->recognizeSegmentFor(fileEntry_); getSegmentMan()->recognizeSegmentFor(fileEntry_);
@ -605,10 +605,10 @@ SharedHandle<Request> AbstractCommand::createProxyRequest() const
if(!proxy.empty()) { if(!proxy.empty()) {
proxyRequest.reset(new Request()); proxyRequest.reset(new Request());
if(proxyRequest->setUri(proxy)) { 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 { } else {
A2_LOG_DEBUG(fmt("CUID#%s - Failed to parse proxy string", A2_LOG_DEBUG(fmt("CUID#%lld - Failed to parse proxy string",
util::itos(getCuid()).c_str())); getCuid()));
proxyRequest.reset(); proxyRequest.reset();
} }
} }
@ -632,7 +632,7 @@ void AbstractCommand::initAsyncNameResolver(const std::string& hostname)
} }
asyncNameResolver_.reset(new AsyncNameResolver(family)); asyncNameResolver_.reset(new AsyncNameResolver(family));
A2_LOG_INFO(fmt(MSG_RESOLVING_HOSTNAME, A2_LOG_INFO(fmt(MSG_RESOLVING_HOSTNAME,
util::itos(getCuid()).c_str(), getCuid(),
hostname.c_str())); hostname.c_str()));
asyncNameResolver_->resolve(hostname); asyncNameResolver_->resolve(hostname);
setNameResolverCheck(asyncNameResolver_); setNameResolverCheck(asyncNameResolver_);
@ -652,7 +652,7 @@ bool AbstractCommand::asyncResolveHostname()
} }
throw DL_ABORT_EX throw DL_ABORT_EX
(fmt(MSG_NAME_RESOLUTION_FAILED, (fmt(MSG_NAME_RESOLUTION_FAILED,
util::itos(getCuid()).c_str(), getCuid(),
asyncNameResolver_->getHostname().c_str(), asyncNameResolver_->getHostname().c_str(),
asyncNameResolver_->getError().c_str())); asyncNameResolver_->getError().c_str()));
default: default:
@ -719,7 +719,7 @@ std::string AbstractCommand::resolveHostname
res.resolve(addrs, hostname); res.resolve(addrs, hostname);
} }
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE, A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE,
util::itos(getCuid()).c_str(), getCuid(),
hostname.c_str(), hostname.c_str(),
strjoin(addrs.begin(), addrs.end(), ", ").c_str())); strjoin(addrs.begin(), addrs.end(), ", ").c_str()));
for(std::vector<std::string>::const_iterator i = addrs.begin(), for(std::vector<std::string>::const_iterator i = addrs.begin(),
@ -730,7 +730,7 @@ std::string AbstractCommand::resolveHostname
} else { } else {
ipaddr = addrs.front(); ipaddr = addrs.front();
A2_LOG_INFO(fmt(MSG_DNS_CACHE_HIT, A2_LOG_INFO(fmt(MSG_DNS_CACHE_HIT,
util::itos(getCuid()).c_str(), getCuid(),
hostname.c_str(), hostname.c_str(),
strjoin(addrs.begin(), addrs.end(), ", ").c_str())); strjoin(addrs.begin(), addrs.end(), ", ").c_str()));
} }
@ -761,7 +761,7 @@ bool AbstractCommand::checkIfConnectionEstablished
e_->markBadIPAddress(connectedHostname, connectedAddr, connectedPort); e_->markBadIPAddress(connectedHostname, connectedAddr, connectedPort);
if(!e_->findCachedIPAddress(connectedHostname, connectedPort).empty()) { if(!e_->findCachedIPAddress(connectedHostname, connectedPort).empty()) {
A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY, A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
util::itos(getCuid()).c_str(), getCuid(),
connectedAddr.c_str(), connectedPort)); connectedAddr.c_str(), connectedPort));
Command* command = Command* command =
InitiateConnectionCommandFactory::createInitiateConnectionCommand InitiateConnectionCommandFactory::createInitiateConnectionCommand

View File

@ -143,7 +143,7 @@ void ActivePeerConnectionCommand::connectToPeer(const SharedHandle<Peer>& peer)
command->setPieceStorage(pieceStorage_); command->setPieceStorage(pieceStorage_);
e_->addCommand(command); e_->addCommand(command);
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_PEER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_PEER,
util::itos(getCuid()).c_str(), getCuid(),
peer->getIPAddress().c_str())); peer->getIPAddress().c_str()));
} }

View File

@ -109,7 +109,7 @@ void BtPieceMessage::doReceivedAction()
SharedHandle<Piece> piece = getPieceStorage()->getPiece(index_); SharedHandle<Piece> piece = getPieceStorage()->getPiece(index_);
off_t offset = (off_t)index_*downloadContext_->getPieceLength()+begin_; off_t offset = (off_t)index_*downloadContext_->getPieceLength()+begin_;
A2_LOG_DEBUG(fmt(MSG_PIECE_RECEIVED, A2_LOG_DEBUG(fmt(MSG_PIECE_RECEIVED,
util::itos(getCuid()).c_str(), getCuid(),
static_cast<unsigned long>(index_), static_cast<unsigned long>(index_),
begin_, begin_,
blockLength_, blockLength_,
@ -118,7 +118,7 @@ void BtPieceMessage::doReceivedAction()
getPieceStorage()->getDiskAdaptor()->writeData getPieceStorage()->getDiskAdaptor()->writeData
(block_, blockLength_, offset); (block_, blockLength_, offset);
piece->completeBlock(slot.getBlockIndex()); 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(), util::toHex(piece->getBitfield(),
piece->getBitfieldLength()).c_str())); piece->getBitfieldLength()).c_str()));
piece->updateHash(begin_, block_, blockLength_); piece->updateHash(begin_, block_, blockLength_);
@ -132,8 +132,8 @@ void BtPieceMessage::doReceivedAction()
} }
} }
} else { } else {
A2_LOG_DEBUG(fmt("CUID#%s - RequestSlot not found, index=%lu, begin=%u", A2_LOG_DEBUG(fmt("CUID#%lld - RequestSlot not found, index=%lu, begin=%u",
util::itos(getCuid()).c_str(), getCuid(),
static_cast<unsigned long>(index_), static_cast<unsigned long>(index_),
begin_)); begin_));
} }
@ -171,7 +171,7 @@ void BtPieceMessage::send()
size_t writtenLength; size_t writtenLength;
if(!isSendingInProgress()) { if(!isSendingInProgress()) {
A2_LOG_INFO(fmt(MSG_SEND_PEER_MESSAGE, A2_LOG_INFO(fmt(MSG_SEND_PEER_MESSAGE,
util::itos(getCuid()).c_str(), getCuid(),
getPeer()->getIPAddress().c_str(), getPeer()->getIPAddress().c_str(),
getPeer()->getPort(), getPeer()->getPort(),
toString().c_str())); toString().c_str()));
@ -235,7 +235,7 @@ bool BtPieceMessage::checkPieceHash(const SharedHandle<Piece>& piece)
void BtPieceMessage::onNewPiece(const SharedHandle<Piece>& piece) void BtPieceMessage::onNewPiece(const SharedHandle<Piece>& piece)
{ {
A2_LOG_INFO(fmt(MSG_GOT_NEW_PIECE, A2_LOG_INFO(fmt(MSG_GOT_NEW_PIECE,
util::itos(getCuid()).c_str(), getCuid(),
static_cast<unsigned long>(piece->getIndex()))); static_cast<unsigned long>(piece->getIndex())));
getPieceStorage()->completePiece(piece); getPieceStorage()->completePiece(piece);
getPieceStorage()->advertisePiece(getCuid(), piece->getIndex()); getPieceStorage()->advertisePiece(getCuid(), piece->getIndex());
@ -244,7 +244,7 @@ void BtPieceMessage::onNewPiece(const SharedHandle<Piece>& piece)
void BtPieceMessage::onWrongPiece(const SharedHandle<Piece>& piece) void BtPieceMessage::onWrongPiece(const SharedHandle<Piece>& piece)
{ {
A2_LOG_INFO(fmt(MSG_GOT_WRONG_PIECE, A2_LOG_INFO(fmt(MSG_GOT_WRONG_PIECE,
util::itos(getCuid()).c_str(), getCuid(),
static_cast<unsigned long>(piece->getIndex()))); static_cast<unsigned long>(piece->getIndex())));
erasePieceOnDisk(piece); erasePieceOnDisk(piece);
piece->clearAllBlock(); piece->clearAllBlock();
@ -274,7 +274,7 @@ void BtPieceMessage::onChokingEvent(const BtChokingEvent& event)
!isSendingInProgress() && !isSendingInProgress() &&
!getPeer()->isInAmAllowedIndexSet(index_)) { !getPeer()->isInAmAllowedIndexSet(index_)) {
A2_LOG_DEBUG(fmt(MSG_REJECT_PIECE_CHOKED, A2_LOG_DEBUG(fmt(MSG_REJECT_PIECE_CHOKED,
util::itos(getCuid()).c_str(), getCuid(),
static_cast<unsigned long>(index_), static_cast<unsigned long>(index_),
begin_, begin_,
blockLength_)); blockLength_));
@ -297,7 +297,7 @@ void BtPieceMessage::onCancelSendingPieceEvent
begin_ == event.getBegin() && begin_ == event.getBegin() &&
blockLength_ == event.getLength()) { blockLength_ == event.getLength()) {
A2_LOG_DEBUG(fmt(MSG_REJECT_PIECE_CANCEL, A2_LOG_DEBUG(fmt(MSG_REJECT_PIECE_CANCEL,
util::itos(getCuid()).c_str(), getCuid(),
static_cast<unsigned long>(index_), static_cast<unsigned long>(index_),
begin_, begin_,
blockLength_)); blockLength_));

View File

@ -101,11 +101,11 @@ bool CheckIntegrityCommand::handleException(Exception& e)
{ {
getDownloadEngine()->getCheckIntegrityMan()->dropPickedEntry(); getDownloadEngine()->getCheckIntegrityMan()->dropPickedEntry();
A2_LOG_ERROR_EX(fmt(MSG_FILE_VALIDATION_FAILURE, A2_LOG_ERROR_EX(fmt(MSG_FILE_VALIDATION_FAILURE,
util::itos(getCuid()).c_str()), getCuid()),
e); e);
A2_LOG_ERROR A2_LOG_ERROR
(fmt(MSG_DOWNLOAD_NOT_COMPLETE, (fmt(MSG_DOWNLOAD_NOT_COMPLETE,
util::itos(getCuid()).c_str(), getCuid(),
getRequestGroup()->getDownloadContext()->getBasePath().c_str())); getRequestGroup()->getDownloadContext()->getBasePath().c_str()));
return true; return true;
} }

View File

@ -56,8 +56,8 @@ Command* CheckIntegrityDispatcherCommand::createCommand
(const SharedHandle<CheckIntegrityEntry>& entry) (const SharedHandle<CheckIntegrityEntry>& entry)
{ {
cuid_t newCUID = getDownloadEngine()->newCUID(); cuid_t newCUID = getDownloadEngine()->newCUID();
A2_LOG_INFO(fmt("CUID#%s - Dispatching CheckIntegrityCommand CUID#%s.", A2_LOG_INFO(fmt("CUID#%lld - Dispatching CheckIntegrityCommand CUID#%s.",
util::itos(getCuid()).c_str(), getCuid(),
util::itos(newCUID).c_str())); util::itos(newCUID).c_str()));
return new CheckIntegrityCommand return new CheckIntegrityCommand
(newCUID, entry->getRequestGroup(), getDownloadEngine(), entry); (newCUID, entry->getRequestGroup(), getDownloadEngine(), entry);

View File

@ -39,7 +39,7 @@
namespace aria2 { namespace aria2 {
typedef int64_t cuid_t; typedef long long int cuid_t;
class Command { class Command {
public: public:

View File

@ -165,14 +165,14 @@ bool DHTEntryPointNameResolveCommand::resolveHostname
switch(resolver->getStatus()) { switch(resolver->getStatus()) {
case AsyncNameResolver::STATUS_READY: case AsyncNameResolver::STATUS_READY:
A2_LOG_INFO(fmt(MSG_RESOLVING_HOSTNAME, A2_LOG_INFO(fmt(MSG_RESOLVING_HOSTNAME,
util::itos(getCuid()).c_str(), getCuid(),
hostname.c_str())); hostname.c_str()));
resolver->resolve(hostname); resolver->resolve(hostname);
setNameResolverCheck(resolver); setNameResolverCheck(resolver);
return false; return false;
case AsyncNameResolver::STATUS_SUCCESS: case AsyncNameResolver::STATUS_SUCCESS:
A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE, A2_LOG_INFO(fmt(MSG_NAME_RESOLUTION_COMPLETE,
util::itos(getCuid()).c_str(), getCuid(),
resolver->getHostname().c_str(), resolver->getHostname().c_str(),
resolver->getResolvedAddresses().front().c_str())); resolver->getResolvedAddresses().front().c_str()));
return true; return true;
@ -180,7 +180,7 @@ bool DHTEntryPointNameResolveCommand::resolveHostname
case AsyncNameResolver::STATUS_ERROR: case AsyncNameResolver::STATUS_ERROR:
throw DL_ABORT_EX throw DL_ABORT_EX
(fmt(MSG_NAME_RESOLUTION_FAILED, (fmt(MSG_NAME_RESOLUTION_FAILED,
util::itos(getCuid()).c_str(), getCuid(),
hostname.c_str(), hostname.c_str(),
resolver->getError().c_str())); resolver->getError().c_str()));
default: default:

View File

@ -117,8 +117,8 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
if(memcmp(message->getPeerId(), bittorrent::getStaticPeerId(), if(memcmp(message->getPeerId(), bittorrent::getStaticPeerId(),
PEER_ID_LENGTH) == 0) { PEER_ID_LENGTH) == 0) {
throw DL_ABORT_EX throw DL_ABORT_EX
(fmt("CUID#%s - Drop connection from the same Peer ID", (fmt("CUID#%lld - Drop connection from the same Peer ID",
util::itos(cuid_).c_str())); cuid_));
} }
std::vector<SharedHandle<Peer> > activePeers; std::vector<SharedHandle<Peer> > activePeers;
peerStorage_->getActivePeers(activePeers); peerStorage_->getActivePeers(activePeers);
@ -126,8 +126,8 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
eoi = activePeers.end(); i != eoi; ++i) { eoi = activePeers.end(); i != eoi; ++i) {
if(memcmp((*i)->getPeerId(), message->getPeerId(), PEER_ID_LENGTH) == 0) { if(memcmp((*i)->getPeerId(), message->getPeerId(), PEER_ID_LENGTH) == 0) {
throw DL_ABORT_EX throw DL_ABORT_EX
(fmt("CUID#%s - Same Peer ID has been already seen.", (fmt("CUID#%lld - Same Peer ID has been already seen.",
util::itos(cuid_).c_str())); cuid_));
} }
} }
@ -135,20 +135,20 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
if(message->isFastExtensionSupported()) { if(message->isFastExtensionSupported()) {
peer_->setFastExtensionEnabled(true); 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()) { if(message->isExtendedMessagingEnabled()) {
peer_->setExtendedMessagingEnabled(true); peer_->setExtendedMessagingEnabled(true);
if(!utPexEnabled_) { if(!utPexEnabled_) {
extensionMessageRegistry_->removeExtension("ut_pex"); 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()) { if(message->isDHTEnabled()) {
peer_->setDHTEnabled(true); 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(), peer_->getIPAddress().c_str(), peer_->getPort(),
message->toString().c_str())); message->toString().c_str()));
return message; return message;
@ -285,7 +285,7 @@ size_t DefaultBtInteractive::receiveMessages() {
} }
++msgcount; ++msgcount;
A2_LOG_INFO(fmt(MSG_RECEIVE_PEER_MESSAGE, A2_LOG_INFO(fmt(MSG_RECEIVE_PEER_MESSAGE,
util::itos(cuid_).c_str(), cuid_,
peer_->getIPAddress().c_str(), peer_->getPort(), peer_->getIPAddress().c_str(), peer_->getPort(),
message->toString().c_str())); message->toString().c_str()));
message->doReceivedAction(); message->doReceivedAction();
@ -325,13 +325,13 @@ size_t DefaultBtInteractive::receiveMessages() {
void DefaultBtInteractive::decideInterest() { void DefaultBtInteractive::decideInterest() {
if(pieceStorage_->hasMissingPiece(peer_)) { if(pieceStorage_->hasMissingPiece(peer_)) {
if(!peer_->amInterested()) { if(!peer_->amInterested()) {
A2_LOG_DEBUG(fmt(MSG_PEER_INTERESTED, util::itos(cuid_).c_str())); A2_LOG_DEBUG(fmt(MSG_PEER_INTERESTED, cuid_));
dispatcher_-> dispatcher_->
addMessageToQueue(messageFactory_->createInterestedMessage()); addMessageToQueue(messageFactory_->createInterestedMessage());
} }
} else { } else {
if(peer_->amInterested()) { 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_-> dispatcher_->
addMessageToQueue(messageFactory_->createNotInterestedMessage()); addMessageToQueue(messageFactory_->createNotInterestedMessage());
} }

View File

@ -155,7 +155,7 @@ public:
void operator()(const RequestSlot& slot) const void operator()(const RequestSlot& slot) const
{ {
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT, A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT,
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(slot.getIndex()), static_cast<unsigned long>(slot.getIndex()),
slot.getBegin(), slot.getBegin(),
static_cast<unsigned long>(slot.getBlockIndex()))); static_cast<unsigned long>(slot.getBlockIndex())));
@ -206,7 +206,7 @@ public:
{ {
if(!peer_->isInPeerAllowedIndexSet(slot.getIndex())) { if(!peer_->isInPeerAllowedIndexSet(slot.getIndex())) {
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_CHOKED, A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_CHOKED,
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(slot.getIndex()), static_cast<unsigned long>(slot.getIndex()),
slot.getBegin(), slot.getBegin(),
static_cast<unsigned long>(slot.getBlockIndex()))); static_cast<unsigned long>(slot.getBlockIndex())));
@ -283,7 +283,7 @@ public:
{ {
if(slot.isTimeout(requestTimeout_)) { if(slot.isTimeout(requestTimeout_)) {
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_TIMEOUT, A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_TIMEOUT,
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(slot.getIndex()), static_cast<unsigned long>(slot.getIndex()),
slot.getBegin(), slot.getBegin(),
static_cast<unsigned long>(slot.getBlockIndex()))); static_cast<unsigned long>(slot.getBlockIndex())));
@ -291,7 +291,7 @@ public:
peer_->snubbing(true); peer_->snubbing(true);
} else if(slot.getPiece()->hasBlock(slot.getBlockIndex())) { } else if(slot.getPiece()->hasBlock(slot.getBlockIndex())) {
A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_ACQUIRED, A2_LOG_DEBUG(fmt(MSG_DELETING_REQUEST_SLOT_ACQUIRED,
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(slot.getIndex()), static_cast<unsigned long>(slot.getIndex()),
slot.getBegin(), slot.getBegin(),
static_cast<unsigned long>(slot.getBlockIndex()))); static_cast<unsigned long>(slot.getBlockIndex())));

View File

@ -199,7 +199,7 @@ bool DownloadCommand::executeInternal() {
// content length, but the client detected that download // content length, but the client detected that download
// completed. // completed.
A2_LOG_INFO(fmt(MSG_SEGMENT_DOWNLOAD_COMPLETED, A2_LOG_INFO(fmt(MSG_SEGMENT_DOWNLOAD_COMPLETED,
util::itos(getCuid()).c_str())); getCuid()));
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
{ {

View File

@ -91,11 +91,11 @@ bool FileAllocationCommand::handleException(Exception& e)
{ {
getDownloadEngine()->getFileAllocationMan()->dropPickedEntry(); getDownloadEngine()->getFileAllocationMan()->dropPickedEntry();
A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE, A2_LOG_ERROR_EX(fmt(MSG_FILE_ALLOCATION_FAILURE,
util::itos(getCuid()).c_str()), getCuid()),
e); e);
A2_LOG_ERROR A2_LOG_ERROR
(fmt(MSG_DOWNLOAD_NOT_COMPLETE, (fmt(MSG_DOWNLOAD_NOT_COMPLETE,
util::itos(getCuid()).c_str(), getCuid(),
getRequestGroup()->getDownloadContext()->getBasePath().c_str())); getRequestGroup()->getDownloadContext()->getBasePath().c_str()));
return true; return true;
} }

View File

@ -46,14 +46,15 @@ namespace aria2 {
FileAllocationDispatcherCommand::FileAllocationDispatcherCommand FileAllocationDispatcherCommand::FileAllocationDispatcherCommand
(cuid_t cuid, (cuid_t cuid,
const SharedHandle<FileAllocationMan>& fileAllocMan, const SharedHandle<FileAllocationMan>& fileAllocMan,
DownloadEngine* e):SequentialDispatcherCommand<FileAllocationEntry> DownloadEngine* e)
(cuid, fileAllocMan, e) {} : SequentialDispatcherCommand<FileAllocationEntry>(cuid, fileAllocMan, e)
{}
Command* FileAllocationDispatcherCommand::createCommand Command* FileAllocationDispatcherCommand::createCommand
(const SharedHandle<FileAllocationEntry>& entry) (const SharedHandle<FileAllocationEntry>& entry)
{ {
cuid_t newCUID = getDownloadEngine()->newCUID(); 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 = FileAllocationCommand* command =
new FileAllocationCommand(newCUID, entry->getRequestGroup(), new FileAllocationCommand(newCUID, entry->getRequestGroup(),
getDownloadEngine(), entry); getDownloadEngine(), entry);

View File

@ -87,7 +87,7 @@ bool FtpConnection::sendUser()
request += authConfig_->getUser(); request += authConfig_->getUser();
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), "USER ********")); cuid_, "USER ********"));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -101,7 +101,7 @@ bool FtpConnection::sendPass()
request += authConfig_->getPassword(); request += authConfig_->getPassword();
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), "PASS ********")); cuid_, "PASS ********"));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -121,7 +121,7 @@ bool FtpConnection::sendType()
request += type; request += type;
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(),request.c_str())); cuid_,request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -133,7 +133,7 @@ bool FtpConnection::sendPwd()
if(socketBuffer_.sendBufferIsEmpty()) { if(socketBuffer_.sendBufferIsEmpty()) {
std::string request = "PWD\r\n"; std::string request = "PWD\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(),request.c_str())); cuid_,request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -147,7 +147,7 @@ bool FtpConnection::sendCwd(const std::string& dir)
request += util::percentDecode(dir); request += util::percentDecode(dir);
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(),request.c_str())); cuid_,request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -161,7 +161,7 @@ bool FtpConnection::sendMdtm()
request += util::percentDecode(req_->getFile()); request += util::percentDecode(req_->getFile());
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -175,7 +175,7 @@ bool FtpConnection::sendSize()
request += util::percentDecode(req_->getFile()); request += util::percentDecode(req_->getFile());
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -187,7 +187,7 @@ bool FtpConnection::sendEpsv()
if(socketBuffer_.sendBufferIsEmpty()) { if(socketBuffer_.sendBufferIsEmpty()) {
static const std::string request("EPSV\r\n"); static const std::string request("EPSV\r\n");
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -199,7 +199,7 @@ bool FtpConnection::sendPasv()
if(socketBuffer_.sendBufferIsEmpty()) { if(socketBuffer_.sendBufferIsEmpty()) {
static const std::string request("PASV\r\n"); static const std::string request("PASV\r\n");
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -234,7 +234,7 @@ bool FtpConnection::sendEprt(const SharedHandle<SocketCore>& serverSocket)
request += util::uitos(addrinfo.second); request += util::uitos(addrinfo.second);
request += "|\r\n"; request += "|\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -264,7 +264,7 @@ bool FtpConnection::sendPort(const SharedHandle<SocketCore>& serverSocket)
request += util::uitos(addrinfo.second%256); request += util::uitos(addrinfo.second%256);
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -282,7 +282,7 @@ bool FtpConnection::sendRest(const SharedHandle<Segment>& segment)
} }
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -296,7 +296,7 @@ bool FtpConnection::sendRetr()
request += util::percentDecode(req_->getFile()); request += util::percentDecode(req_->getFile());
request += "\r\n"; request += "\r\n";
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), request.c_str())); cuid_, request.c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
} }
socketBuffer_.send(); socketBuffer_.send();
@ -392,7 +392,7 @@ bool FtpConnection::bulkReceiveResponse
response.first = status; response.first = status;
response.second = strbuf_.substr(0, length); response.second = strbuf_.substr(0, length);
A2_LOG_INFO(fmt(MSG_RECEIVE_RESPONSE, A2_LOG_INFO(fmt(MSG_RECEIVE_RESPONSE,
util::itos(cuid_).c_str(), cuid_,
response.second.c_str())); response.second.c_str()));
strbuf_.erase(0, length); strbuf_.erase(0, length);
return true; return true;

View File

@ -91,20 +91,20 @@ bool FtpFinishDownloadCommand::execute()
getSocket(), options); getSocket(), options);
} }
} else { } else {
A2_LOG_INFO(fmt("CUID#%s - Bad status for transfer complete.", A2_LOG_INFO(fmt("CUID#%lld - Bad status for transfer complete.",
util::itos(getCuid()).c_str())); getCuid()));
} }
} else if(getCheckPoint().difference(global::wallclock) >= getTimeout()) { } else if(getCheckPoint().difference(global::wallclock) >= getTimeout()) {
A2_LOG_INFO(fmt("CUID#%s - Timeout before receiving transfer complete.", A2_LOG_INFO(fmt("CUID#%lld - Timeout before receiving transfer complete.",
util::itos(getCuid()).c_str())); getCuid()));
} else { } else {
getDownloadEngine()->addCommand(this); getDownloadEngine()->addCommand(this);
return false; return false;
} }
} catch(RecoverableException& e) { } 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.", " finished, so we can ignore the exception.",
util::itos(getCuid()).c_str()), getCuid()),
e); e);
} }
if(getRequestGroup()->downloadFinished()) { if(getRequestGroup()->downloadFinished()) {

View File

@ -91,7 +91,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
} }
if(!pooledSocket) { if(!pooledSocket) {
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), addr.c_str(), port)); getCuid(), addr.c_str(), port));
createSocket(); createSocket();
getSocket()->establishConnection(addr, port); getSocket()->establishConnection(addr, port);
@ -154,7 +154,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
(getRequest(), getOption().get())->getUser()); (getRequest(), getOption().get())->getUser());
if(!pooledSocket) { if(!pooledSocket) {
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), addr.c_str(), port)); getCuid(), addr.c_str(), port));
createSocket(); createSocket();
getSocket()->establishConnection(addr, port); getSocket()->establishConnection(addr, port);
FtpNegotiationCommand* c = FtpNegotiationCommand* c =

View File

@ -254,8 +254,8 @@ bool FtpNegotiationCommand::recvPwd()
throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status));
} }
ftp_->setBaseWorkingDir(pwd); ftp_->setBaseWorkingDir(pwd);
A2_LOG_INFO(fmt("CUID#%s - base working directory is '%s'", A2_LOG_INFO(fmt("CUID#%lld - base working directory is '%s'",
util::itos(getCuid()).c_str(), pwd.c_str())); getCuid(), pwd.c_str()));
sequence_ = SEQ_SEND_CWD_PREP; sequence_ = SEQ_SEND_CWD_PREP;
return true; return true;
} }
@ -338,8 +338,8 @@ bool FtpNegotiationCommand::recvMdtm()
" a time value as in specified in RFC3659."); " a time value as in specified in RFC3659.");
} }
} else { } else {
A2_LOG_INFO(fmt("CUID#%s - MDTM command failed.", A2_LOG_INFO(fmt("CUID#%lld - MDTM command failed.",
util::itos(getCuid()).c_str())); getCuid()));
} }
sequence_ = SEQ_SEND_SIZE; sequence_ = SEQ_SEND_SIZE;
return true; return true;
@ -474,8 +474,8 @@ bool FtpNegotiationCommand::recvSize() {
} }
} else { } else {
A2_LOG_INFO(fmt("CUID#%s - The remote FTP Server doesn't recognize SIZE" A2_LOG_INFO(fmt("CUID#%lld - The remote FTP Server doesn't recognize SIZE"
" command. Continue.", util::itos(getCuid()).c_str())); " command. Continue.", getCuid()));
// Even if one of the other servers waiting in the queue supports SIZE // Even if one of the other servers waiting in the queue supports SIZE
// command, resuming and segmented downloading are disabled when the first // command, resuming and segmented downloading are disabled when the first
// contacted FTP server doesn't support it. // contacted FTP server doesn't support it.
@ -639,7 +639,7 @@ bool FtpNegotiationCommand::preparePasvConnect() {
} else { } else {
// make a data connection to the server. // make a data connection to the server.
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), getCuid(),
dataConnAddr_.first.c_str(), dataConnAddr_.first.c_str(),
dataConnAddr_.second)); dataConnAddr_.second));
dataSocket_.reset(new SocketCore()); dataSocket_.reset(new SocketCore());
@ -661,7 +661,7 @@ bool FtpNegotiationCommand::resolveProxy()
return false; return false;
} }
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), getCuid(),
proxyAddr_.c_str(), proxyReq->getPort())); proxyAddr_.c_str(), proxyReq->getPort()));
dataSocket_.reset(new SocketCore()); dataSocket_.reset(new SocketCore());
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort()); dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
@ -691,11 +691,11 @@ bool FtpNegotiationCommand::sendTunnelRequest()
error.c_str())); error.c_str()));
} else { } else {
A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY, A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
util::itos(getCuid()).c_str(), getCuid(),
proxyAddr_.c_str(), proxyReq->getPort())); proxyAddr_.c_str(), proxyReq->getPort()));
proxyAddr_ = nextProxyAddr; proxyAddr_ = nextProxyAddr;
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), getCuid(),
proxyAddr_.c_str(), proxyReq->getPort())); proxyAddr_.c_str(), proxyReq->getPort()));
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort()); dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
return false; return false;

View File

@ -98,7 +98,7 @@ void HttpConnection::sendRequest(const SharedHandle<HttpRequest>& httpRequest)
{ {
std::string request = httpRequest->createRequest(); std::string request = httpRequest->createRequest();
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), cuid_,
eraseConfidentialInfo(request).c_str())); eraseConfidentialInfo(request).c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
socketBuffer_.send(); socketBuffer_.send();
@ -111,7 +111,7 @@ void HttpConnection::sendProxyRequest
{ {
std::string request = httpRequest->createProxyRequest(); std::string request = httpRequest->createProxyRequest();
A2_LOG_INFO(fmt(MSG_SENDING_REQUEST, A2_LOG_INFO(fmt(MSG_SENDING_REQUEST,
util::itos(cuid_).c_str(), cuid_,
eraseConfidentialInfo(request).c_str())); eraseConfidentialInfo(request).c_str()));
socketBuffer_.pushStr(request); socketBuffer_.pushStr(request);
socketBuffer_.send(); socketBuffer_.send();
@ -146,7 +146,7 @@ SharedHandle<HttpResponse> HttpConnection::receiveResponse()
size -= putbackDataLength; size -= putbackDataLength;
socket_->readData(buf, size); socket_->readData(buf, size);
A2_LOG_INFO(fmt(MSG_RECEIVE_RESPONSE, A2_LOG_INFO(fmt(MSG_RECEIVE_RESPONSE,
util::itos(cuid_).c_str(), cuid_,
proc->getHeaderString().c_str())); proc->getHeaderString().c_str()));
SharedHandle<HttpHeader> httpHeader = proc->getHttpResponseHeader(); SharedHandle<HttpHeader> httpHeader = proc->getHttpResponseHeader();
SharedHandle<HttpResponse> httpResponse(new HttpResponse()); SharedHandle<HttpResponse> httpResponse(new HttpResponse());

View File

@ -78,7 +78,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand
std::string proxyMethod = resolveProxyMethod(getRequest()->getProtocol()); std::string proxyMethod = resolveProxyMethod(getRequest()->getProtocol());
if(!pooledSocket) { if(!pooledSocket) {
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), addr.c_str(), port)); getCuid(), addr.c_str(), port));
createSocket(); createSocket();
getSocket()->establishConnection(addr, port); getSocket()->establishConnection(addr, port);
@ -131,7 +131,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand
(resolvedAddresses, getRequest()->getPort()); (resolvedAddresses, getRequest()->getPort());
if(!pooledSocket) { if(!pooledSocket) {
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), addr.c_str(), port)); getCuid(), addr.c_str(), port));
createSocket(); createSocket();
getSocket()->establishConnection(addr, port); getSocket()->establishConnection(addr, port);
getRequest()->setConnectedAddrInfo(hostname, addr, port); getRequest()->setConnectedAddrInfo(hostname, addr, port);

View File

@ -85,7 +85,7 @@ bool HttpListenCommand::execute()
e_->addCommand(c); e_->addCommand(c);
} }
} catch(RecoverableException& e) { } 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); e_->addCommand(this);
return false; return false;
@ -97,8 +97,8 @@ bool HttpListenCommand::bindPort(uint16_t port)
e_->deleteSocketForReadCheck(serverSocket_, this); e_->deleteSocketForReadCheck(serverSocket_, this);
} }
serverSocket_.reset(new SocketCore()); serverSocket_.reset(new SocketCore());
A2_LOG_INFO(fmt("CUID#%s - Setting up HttpListenCommand for IPv%d", A2_LOG_INFO(fmt("CUID#%lld - Setting up HttpListenCommand for IPv%d",
util::itos(getCuid()).c_str(), getCuid(),
family_ == AF_INET?4:6)); family_ == AF_INET?4:6));
try { try {
int flags = 0; int flags = 0;
@ -109,14 +109,14 @@ bool HttpListenCommand::bindPort(uint16_t port)
serverSocket_->beginListen(); serverSocket_->beginListen();
serverSocket_->setNonBlockingMode(); serverSocket_->setNonBlockingMode();
A2_LOG_INFO(fmt(MSG_LISTENING_PORT, A2_LOG_INFO(fmt(MSG_LISTENING_PORT,
util::itos(getCuid()).c_str(), port)); getCuid(), port));
e_->addSocketForReadCheck(serverSocket_, this); e_->addSocketForReadCheck(serverSocket_, this);
return true; return true;
} catch(RecoverableException& e) { } catch(RecoverableException& e) {
A2_LOG_ERROR(fmt("Failed to setup XML-RPC server for IPv%d", A2_LOG_ERROR(fmt("Failed to setup XML-RPC server for IPv%d",
family_ == AF_INET?4:6)); family_ == AF_INET?4:6));
A2_LOG_ERROR_EX(fmt(MSG_BIND_FAILURE, A2_LOG_ERROR_EX(fmt(MSG_BIND_FAILURE,
util::itos(getCuid()).c_str(), port), getCuid(), port),
e); e);
if(serverSocket_) { if(serverSocket_) {
e_->deleteSocketForReadCheck(serverSocket_, this); e_->deleteSocketForReadCheck(serverSocket_, this);

View File

@ -115,7 +115,7 @@ std::string HttpResponse::determinFilename() const
} }
} else { } else {
A2_LOG_INFO(fmt(MSG_CONTENT_DISPOSITION_DETECTED, A2_LOG_INFO(fmt(MSG_CONTENT_DISPOSITION_DETECTED,
util::itos(cuid_).c_str(), cuid_,
contentDisposition.c_str())); contentDisposition.c_str()));
return contentDisposition; return contentDisposition;
} }
@ -147,12 +147,12 @@ void HttpResponse::processRedirect()
if(httpRequest_->getRequest()->redirectUri(getRedirectURI())) { if(httpRequest_->getRequest()->redirectUri(getRedirectURI())) {
A2_LOG_INFO(fmt(MSG_REDIRECT, A2_LOG_INFO(fmt(MSG_REDIRECT,
util::itos(cuid_).c_str(), cuid_,
httpRequest_->getRequest()->getCurrentUri().c_str())); httpRequest_->getRequest()->getCurrentUri().c_str()));
} else { } else {
throw DL_RETRY_EX throw DL_RETRY_EX
(fmt("CUID#%s - Redirect to %s failed. It may not be a valid URI.", (fmt("CUID#%lld - Redirect to %s failed. It may not be a valid URI.",
util::itos(cuid_).c_str(), cuid_,
httpRequest_->getRequest()->getCurrentUri().c_str())); httpRequest_->getRequest()->getCurrentUri().c_str()));
} }
} }

View File

@ -119,8 +119,8 @@ bool HttpServerBodyCommand::execute()
} }
} catch(RecoverableException& e) { } catch(RecoverableException& e) {
A2_LOG_INFO_EX A2_LOG_INFO_EX
(fmt("CUID#%s - Error occurred while reading HTTP request body", (fmt("CUID#%lld - Error occurred while reading HTTP request body",
util::itos(getCuid()).c_str()), getCuid()),
e); e);
return true; return true;
} }

View File

@ -141,8 +141,8 @@ bool HttpServerCommand::execute()
} }
} }
} catch(RecoverableException& e) { } catch(RecoverableException& e) {
A2_LOG_INFO_EX(fmt("CUID#%s - Error occurred while reading HTTP request", A2_LOG_INFO_EX(fmt("CUID#%lld - Error occurred while reading HTTP request",
util::itos(getCuid()).c_str()), getCuid()),
e); e);
return true; return true;
} }

View File

@ -75,26 +75,26 @@ bool HttpServerResponseCommand::execute()
httpServer_->sendResponse(); httpServer_->sendResponse();
} catch(RecoverableException& e) { } catch(RecoverableException& e) {
A2_LOG_INFO_EX A2_LOG_INFO_EX
(fmt("CUID#%s - Error occurred while transmitting response body.", (fmt("CUID#%lld - Error occurred while transmitting response body.",
util::itos(getCuid()).c_str()), getCuid()),
e); e);
return true; return true;
} }
if(httpServer_->sendBufferIsEmpty()) { if(httpServer_->sendBufferIsEmpty()) {
A2_LOG_INFO(fmt("CUID#%s - HttpServer: all response transmitted.", A2_LOG_INFO(fmt("CUID#%lld - HttpServer: all response transmitted.",
util::itos(getCuid()).c_str())); getCuid()));
if(httpServer_->supportsPersistentConnection()) { if(httpServer_->supportsPersistentConnection()) {
A2_LOG_INFO(fmt("CUID#%s - Persist connection.", A2_LOG_INFO(fmt("CUID#%lld - Persist connection.",
util::itos(getCuid()).c_str())); getCuid()));
e_->addCommand e_->addCommand
(new HttpServerCommand(getCuid(), httpServer_, e_, socket_)); (new HttpServerCommand(getCuid(), httpServer_, e_, socket_));
} }
return true; return true;
} else { } else {
if(timeoutTimer_.difference(global::wallclock) >= 10) { 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.", " response.",
util::itos(getCuid()).c_str())); getCuid()));
return true; return true;
} else { } else {
e_->addCommand(this); e_->addCommand(this);

View File

@ -101,7 +101,7 @@ bool InitiateConnectionCommand::executeInternal() {
if(!getDownloadEngine()->findCachedIPAddress(hostname, port).empty()) { if(!getDownloadEngine()->findCachedIPAddress(hostname, port).empty()) {
A2_LOG_INFO_EX(EX_EXCEPTION_CAUGHT, ex); A2_LOG_INFO_EX(EX_EXCEPTION_CAUGHT, ex);
A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY, A2_LOG_INFO(fmt(MSG_CONNECT_FAILED_AND_RETRY,
util::itos(getCuid()).c_str(), getCuid(),
ipaddr.c_str(), port)); ipaddr.c_str(), port));
Command* command = Command* command =
InitiateConnectionCommandFactory::createInitiateConnectionCommand InitiateConnectionCommandFactory::createInitiateConnectionCommand

View File

@ -173,9 +173,9 @@ bool InitiatorMSEHandshakeCommand::executeInternal() {
bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait) bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
{ {
if(getOption()->getAsBool(PREF_BT_REQUIRE_CRYPTO)) { 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.", " handshake is disabled by preference.",
util::itos(getCuid()).c_str())); getCuid()));
if(peerStorage_->isPeerAvailable() && btRuntime_->lessThanEqMinPeers()) { if(peerStorage_->isPeerAvailable() && btRuntime_->lessThanEqMinPeers()) {
SharedHandle<Peer> peer = peerStorage_->getUnusedPeer(); SharedHandle<Peer> peer = peerStorage_->getUnusedPeer();
peer->usedBy(getDownloadEngine()->newCUID()); peer->usedBy(getDownloadEngine()->newCUID());
@ -189,8 +189,8 @@ bool InitiatorMSEHandshakeCommand::prepareForNextPeer(time_t wait)
return true; return true;
} else { } else {
// try legacy BitTorrent handshake // try legacy BitTorrent handshake
A2_LOG_INFO(fmt("CUID#%s - Retry using legacy BitTorrent handshake.", A2_LOG_INFO(fmt("CUID#%lld - Retry using legacy BitTorrent handshake.",
util::itos(getCuid()).c_str())); getCuid()));
PeerInitiateConnectionCommand* command = PeerInitiateConnectionCommand* command =
new PeerInitiateConnectionCommand(getCuid(), requestGroup_, getPeer(), new PeerInitiateConnectionCommand(getCuid(), requestGroup_, getPeer(),
getDownloadEngine(), btRuntime_, false); getDownloadEngine(), btRuntime_, false);

View File

@ -106,12 +106,12 @@ MSEHandshake::HANDSHAKE_TYPE MSEHandshake::identifyHandshakeType()
} }
if(rbuf_[0] == BtHandshakeMessage::PSTR_LENGTH && if(rbuf_[0] == BtHandshakeMessage::PSTR_LENGTH &&
memcmp(BtHandshakeMessage::BT_PSTR, rbuf_+1, 19) == 0) { memcmp(BtHandshakeMessage::BT_PSTR, rbuf_+1, 19) == 0) {
A2_LOG_DEBUG(fmt("CUID#%s - This is legacy BitTorrent handshake.", A2_LOG_DEBUG(fmt("CUID#%lld - This is legacy BitTorrent handshake.",
util::itos(cuid_).c_str())); cuid_));
return HANDSHAKE_LEGACY; return HANDSHAKE_LEGACY;
} else { } else {
A2_LOG_DEBUG(fmt("CUID#%s - This may be encrypted BitTorrent handshake.", A2_LOG_DEBUG(fmt("CUID#%lld - This may be encrypted BitTorrent handshake.",
util::itos(cuid_).c_str())); cuid_));
return HANDSHAKE_ENCRYPTED; return HANDSHAKE_ENCRYPTED;
} }
} }
@ -122,15 +122,15 @@ void MSEHandshake::initEncryptionFacility(bool initiator)
dh_ = new DHKeyExchange(); dh_ = new DHKeyExchange();
dh_->init(PRIME, PRIME_BITS, GENERATOR, 160); dh_->init(PRIME, PRIME_BITS, GENERATOR, 160);
dh_->generatePublicKey(); 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; initiator_ = initiator;
} }
bool MSEHandshake::sendPublicKey() bool MSEHandshake::sendPublicKey()
{ {
if(socketBuffer_.sendBufferIsEmpty()) { if(socketBuffer_.sendBufferIsEmpty()) {
A2_LOG_DEBUG(fmt("CUID#%s - Sending public key.", A2_LOG_DEBUG(fmt("CUID#%lld - Sending public key.",
util::itos(cuid_).c_str())); cuid_));
unsigned char buffer[KEY_LENGTH+MAX_PAD_LENGTH]; unsigned char buffer[KEY_LENGTH+MAX_PAD_LENGTH];
dh_->getPublicKey(buffer, KEY_LENGTH); dh_->getPublicKey(buffer, KEY_LENGTH);
@ -149,8 +149,8 @@ bool MSEHandshake::receivePublicKey()
if(r > receiveNBytes(r)) { if(r > receiveNBytes(r)) {
return false; return false;
} }
A2_LOG_DEBUG(fmt("CUID#%s - public key received.", A2_LOG_DEBUG(fmt("CUID#%lld - public key received.",
util::itos(cuid_).c_str())); cuid_));
// TODO handle exception. in catch, resbufLength = 0; // TODO handle exception. in catch, resbufLength = 0;
dh_->computeSecret(secret_, sizeof(secret_), rbuf_, rbufLength_); dh_->computeSecret(secret_, sizeof(secret_), rbuf_, rbufLength_);
// reset rbufLength_ // reset rbufLength_
@ -254,8 +254,8 @@ uint16_t MSEHandshake::decodeLength16(const unsigned char* buffer)
bool MSEHandshake::sendInitiatorStep2() bool MSEHandshake::sendInitiatorStep2()
{ {
if(socketBuffer_.sendBufferIsEmpty()) { if(socketBuffer_.sendBufferIsEmpty()) {
A2_LOG_DEBUG(fmt("CUID#%s - Sending negotiation step2.", A2_LOG_DEBUG(fmt("CUID#%lld - Sending negotiation step2.",
util::itos(cuid_).c_str())); cuid_));
unsigned char md[20]; unsigned char md[20];
createReq1Hash(md); createReq1Hash(md);
socketBuffer_.pushStr(std::string(&md[0], &md[sizeof(md)])); socketBuffer_.pushStr(std::string(&md[0], &md[sizeof(md)]));
@ -341,8 +341,8 @@ bool MSEHandshake::findInitiatorVCMarker()
size_t toRead = markerIndex_+VC_LENGTH-rbufLength_; size_t toRead = markerIndex_+VC_LENGTH-rbufLength_;
socket_->readData(rbuf_+rbufLength_, toRead); socket_->readData(rbuf_+rbufLength_, toRead);
rbufLength_ += toRead; rbufLength_ += toRead;
A2_LOG_DEBUG(fmt("CUID#%s - VC marker found at %lu", A2_LOG_DEBUG(fmt("CUID#%lld - VC marker found at %lu",
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(markerIndex_))); static_cast<unsigned long>(markerIndex_)));
verifyVC(rbuf_+markerIndex_); verifyVC(rbuf_+markerIndex_);
// reset rbufLength_ // reset rbufLength_
@ -364,19 +364,19 @@ bool MSEHandshake::receiveInitiatorCryptoSelectAndPadDLength()
rbufptr, sizeof(cryptoSelect)); rbufptr, sizeof(cryptoSelect));
if(cryptoSelect[3]&CRYPTO_PLAIN_TEXT && if(cryptoSelect[3]&CRYPTO_PLAIN_TEXT &&
option_->get(PREF_BT_MIN_CRYPTO_LEVEL) == V_PLAIN) { option_->get(PREF_BT_MIN_CRYPTO_LEVEL) == V_PLAIN) {
A2_LOG_DEBUG(fmt("CUID#%s - peer prefers plaintext.", A2_LOG_DEBUG(fmt("CUID#%lld - peer prefers plaintext.",
util::itos(cuid_).c_str())); cuid_));
negotiatedCryptoType_ = CRYPTO_PLAIN_TEXT; negotiatedCryptoType_ = CRYPTO_PLAIN_TEXT;
} }
if(cryptoSelect[3]&CRYPTO_ARC4) { if(cryptoSelect[3]&CRYPTO_ARC4) {
A2_LOG_DEBUG(fmt("CUID#%s - peer prefers ARC4", A2_LOG_DEBUG(fmt("CUID#%lld - peer prefers ARC4",
util::itos(cuid_).c_str())); cuid_));
negotiatedCryptoType_ = CRYPTO_ARC4; negotiatedCryptoType_ = CRYPTO_ARC4;
} }
if(negotiatedCryptoType_ == CRYPTO_NONE) { if(negotiatedCryptoType_ == CRYPTO_NONE) {
throw DL_ABORT_EX throw DL_ABORT_EX
(fmt("CUID#%s - No supported crypto type selected.", (fmt("CUID#%lld - No supported crypto type selected.",
util::itos(cuid_).c_str())); cuid_));
} }
} }
// padD length // padD length
@ -437,8 +437,8 @@ bool MSEHandshake::findReceiverHashMarker()
size_t toRead = markerIndex_+20-rbufLength_; size_t toRead = markerIndex_+20-rbufLength_;
socket_->readData(rbuf_+rbufLength_, toRead); socket_->readData(rbuf_+rbufLength_, toRead);
rbufLength_ += toRead; rbufLength_ += toRead;
A2_LOG_DEBUG(fmt("CUID#%s - Hash marker found at %lu.", A2_LOG_DEBUG(fmt("CUID#%lld - Hash marker found at %lu.",
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(markerIndex_))); static_cast<unsigned long>(markerIndex_)));
verifyReq1Hash(rbuf_+markerIndex_); verifyReq1Hash(rbuf_+markerIndex_);
// reset rbufLength_ // reset rbufLength_
@ -464,8 +464,8 @@ bool MSEHandshake::receiveReceiverHashAndPadCLength
const unsigned char* infohash = bittorrent::getInfoHash(*i); const unsigned char* infohash = bittorrent::getInfoHash(*i);
createReq23Hash(md, infohash); createReq23Hash(md, infohash);
if(memcmp(md, rbufptr, sizeof(md)) == 0) { if(memcmp(md, rbufptr, sizeof(md)) == 0) {
A2_LOG_DEBUG(fmt("CUID#%s - info hash found: %s", A2_LOG_DEBUG(fmt("CUID#%lld - info hash found: %s",
util::itos(cuid_).c_str(), cuid_,
util::toHex(infohash, INFO_HASH_LENGTH).c_str())); util::toHex(infohash, INFO_HASH_LENGTH).c_str()));
downloadContext = *i; downloadContext = *i;
break; break;
@ -488,18 +488,18 @@ bool MSEHandshake::receiveReceiverHashAndPadCLength
// For now, choose ARC4. // For now, choose ARC4.
if(cryptoProvide[3]&CRYPTO_PLAIN_TEXT && if(cryptoProvide[3]&CRYPTO_PLAIN_TEXT &&
option_->get(PREF_BT_MIN_CRYPTO_LEVEL) == V_PLAIN) { option_->get(PREF_BT_MIN_CRYPTO_LEVEL) == V_PLAIN) {
A2_LOG_DEBUG(fmt("CUID#%s - peer provides plaintext.", A2_LOG_DEBUG(fmt("CUID#%lld - peer provides plaintext.",
util::itos(cuid_).c_str())); cuid_));
negotiatedCryptoType_ = CRYPTO_PLAIN_TEXT; negotiatedCryptoType_ = CRYPTO_PLAIN_TEXT;
} else if(cryptoProvide[3]&CRYPTO_ARC4) { } else if(cryptoProvide[3]&CRYPTO_ARC4) {
A2_LOG_DEBUG(fmt("CUID#%s - peer provides ARC4.", A2_LOG_DEBUG(fmt("CUID#%lld - peer provides ARC4.",
util::itos(cuid_).c_str())); cuid_));
negotiatedCryptoType_ = CRYPTO_ARC4; negotiatedCryptoType_ = CRYPTO_ARC4;
} }
if(negotiatedCryptoType_ == CRYPTO_NONE) { if(negotiatedCryptoType_ == CRYPTO_NONE) {
throw DL_ABORT_EX throw DL_ABORT_EX
(fmt("CUID#%s - No supported crypto type provided.", (fmt("CUID#%lld - No supported crypto type provided.",
util::itos(cuid_).c_str())); cuid_));
} }
} }
// decrypt PadC length // decrypt PadC length
@ -518,8 +518,8 @@ bool MSEHandshake::receiveReceiverIALength()
return false; return false;
} }
iaLength_ = decodeLength16(rbuf_); iaLength_ = decodeLength16(rbuf_);
A2_LOG_DEBUG(fmt("CUID#%s - len(IA)=%u.", A2_LOG_DEBUG(fmt("CUID#%lld - len(IA)=%u.",
util::itos(cuid_).c_str(), iaLength_)); cuid_, iaLength_));
// reset rbufLength_ // reset rbufLength_
rbufLength_ = 0; rbufLength_ = 0;
return true; return true;
@ -537,7 +537,7 @@ bool MSEHandshake::receiveReceiverIA()
delete [] ia_; delete [] ia_;
ia_ = new unsigned char[iaLength_]; ia_ = new unsigned char[iaLength_];
decryptor_->decrypt(ia_, iaLength_, rbuf_, 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_ // reset rbufLength_
rbufLength_ = 0; rbufLength_ = 0;
return true; return true;
@ -576,11 +576,11 @@ bool MSEHandshake::sendReceiverStep2()
uint16_t MSEHandshake::verifyPadLength(const unsigned char* padlenbuf, const char* padName) uint16_t MSEHandshake::verifyPadLength(const unsigned char* padlenbuf, const char* padName)
{ {
A2_LOG_DEBUG(fmt("CUID#%s - Verifying Pad length for %s", A2_LOG_DEBUG(fmt("CUID#%lld - Verifying Pad length for %s",
util::itos(cuid_).c_str(), padName)); cuid_, padName));
uint16_t padLength = decodeLength16(padlenbuf); uint16_t padLength = decodeLength16(padlenbuf);
A2_LOG_DEBUG(fmt("CUID#%s - len(%s)=%u", A2_LOG_DEBUG(fmt("CUID#%lld - len(%s)=%u",
util::itos(cuid_).c_str(), padName, padLength)); cuid_, padName, padLength));
if(padLength > 512) { if(padLength > 512) {
throw DL_ABORT_EX throw DL_ABORT_EX
(fmt("Too large %s length: %u", padName, padLength)); (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) 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]; unsigned char vc[VC_LENGTH];
decryptor_->decrypt(vc, sizeof(vc), vcbuf, sizeof(vc)); decryptor_->decrypt(vc, sizeof(vc), vcbuf, sizeof(vc));
if(memcmp(VC, vc, sizeof(VC)) != 0) { 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) 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]; unsigned char md[20];
createReq1Hash(md); createReq1Hash(md);
if(memcmp(md, req1buf, sizeof(md)) != 0) { if(memcmp(md, req1buf, sizeof(md)) != 0) {

View File

@ -78,9 +78,9 @@ PeerAbstractCommand::~PeerAbstractCommand()
bool PeerAbstractCommand::execute() 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", " socket: read:%d, write:%d, hup:%d, err:%d, noCheck:%d",
util::itos(getCuid()).c_str(), getCuid(),
readEventEnabled(), writeEventEnabled(), readEventEnabled(), writeEventEnabled(),
hupEventEnabled(), errorEventEnabled(), hupEventEnabled(), errorEventEnabled(),
noCheck_)); noCheck_));
@ -110,10 +110,10 @@ bool PeerAbstractCommand::execute()
return true; return true;
} catch(RecoverableException& err) { } catch(RecoverableException& err) {
A2_LOG_DEBUG_EX(fmt(MSG_TORRENT_DOWNLOAD_ABORTED, A2_LOG_DEBUG_EX(fmt(MSG_TORRENT_DOWNLOAD_ABORTED,
util::itos(getCuid()).c_str()), getCuid()),
err); err);
A2_LOG_DEBUG(fmt(MSG_PEER_BANNED, A2_LOG_DEBUG(fmt(MSG_PEER_BANNED,
util::itos(getCuid()).c_str(), getCuid(),
peer_->getIPAddress().c_str(), peer_->getIPAddress().c_str(),
peer_->getPort())); peer_->getPort()));
onAbort(); onAbort();

View File

@ -122,9 +122,9 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength) {
return false; return false;
} }
// we got EOF // we got EOF
A2_LOG_DEBUG(fmt("CUID#%s - In PeerConnection::receiveMessage()," A2_LOG_DEBUG(fmt("CUID#%lld - In PeerConnection::receiveMessage(),"
" remain=%lu", " remain=%lu",
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(temp))); static_cast<unsigned long>(temp)));
peer_->setDisconnectedGracefully(true); peer_->setDisconnectedGracefully(true);
throw DL_ABORT_EX(EX_EOF_FROM_PEER); throw DL_ABORT_EX(EX_EOF_FROM_PEER);
@ -155,9 +155,9 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength) {
return false; return false;
} }
// we got EOF // 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", " payloadlen=%lu, remaining=%lu",
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(currentPayloadLength_), static_cast<unsigned long>(currentPayloadLength_),
static_cast<unsigned long>(temp))); static_cast<unsigned long>(temp)));
peer_->setDisconnectedGracefully(true); peer_->setDisconnectedGracefully(true);
@ -207,8 +207,8 @@ bool PeerConnection::receiveHandshake(unsigned char* data, size_t& dataLength,
} }
// we got EOF // we got EOF
A2_LOG_DEBUG A2_LOG_DEBUG
(fmt("CUID#%s - In PeerConnection::receiveHandshake(), remain=%lu", (fmt("CUID#%lld - In PeerConnection::receiveHandshake(), remain=%lu",
util::itos(cuid_).c_str(), cuid_,
static_cast<unsigned long>(temp))); static_cast<unsigned long>(temp)));
peer_->setDisconnectedGracefully(true); peer_->setDisconnectedGracefully(true);
throw DL_ABORT_EX(EX_EOF_FROM_PEER); throw DL_ABORT_EX(EX_EOF_FROM_PEER);

View File

@ -77,7 +77,7 @@ PeerInitiateConnectionCommand::~PeerInitiateConnectionCommand()
bool PeerInitiateConnectionCommand::executeInternal() { bool PeerInitiateConnectionCommand::executeInternal() {
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER, A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
util::itos(getCuid()).c_str(), getCuid(),
getPeer()->getIPAddress().c_str(), getPeer()->getIPAddress().c_str(),
getPeer()->getPort())); getPeer()->getPort()));
createSocket(); createSocket();

View File

@ -98,7 +98,7 @@ bool PeerListenCommand::bindPort(uint16_t& port, IntSequence& seq)
return true; return true;
} catch(RecoverableException& ex) { } catch(RecoverableException& ex) {
A2_LOG_ERROR_EX(fmt(MSG_BIND_FAILURE, A2_LOG_ERROR_EX(fmt(MSG_BIND_FAILURE,
util::itos(getCuid()).c_str(), port), getCuid(), port),
ex); ex);
socket_->closeConnection(); socket_->closeConnection();
} }
@ -138,11 +138,11 @@ bool PeerListenCommand::execute() {
A2_LOG_DEBUG(fmt("Accepted the connection from %s:%u.", A2_LOG_DEBUG(fmt("Accepted the connection from %s:%u.",
peer->getIPAddress().c_str(), peer->getIPAddress().c_str(),
peer->getPort())); peer->getPort()));
A2_LOG_DEBUG(fmt("Added CUID#%s to receive BitTorrent/MSE handshake.", A2_LOG_DEBUG(fmt("Added CUID#%lld to receive BitTorrent/MSE handshake.",
util::itos(cuid).c_str())); cuid));
} catch(RecoverableException& ex) { } catch(RecoverableException& ex) {
A2_LOG_DEBUG_EX(fmt(MSG_ACCEPT_FAILURE, A2_LOG_DEBUG_EX(fmt(MSG_ACCEPT_FAILURE,
util::itos(getCuid()).c_str()), getCuid()),
ex); ex);
} }
} }

View File

@ -144,7 +144,7 @@ bool PeerReceiveHandshakeCommand::executeInternal()
peerConnection_); peerConnection_);
getDownloadEngine()->addCommand(command); getDownloadEngine()->addCommand(command);
A2_LOG_DEBUG(fmt(MSG_INCOMING_PEER_CONNECTION, A2_LOG_DEBUG(fmt(MSG_INCOMING_PEER_CONNECTION,
util::itos(getCuid()).c_str(), getCuid(),
util::itos(getPeer()->usedBy()).c_str())); util::itos(getPeer()->usedBy()).c_str()));
} }
} }

View File

@ -120,9 +120,9 @@ SharedHandle<Segment> SegmentMan::checkoutSegment
if(!piece) { if(!piece) {
return SharedHandle<Segment>(); 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()), static_cast<unsigned long>(piece->getIndex()),
util::itos(cuid).c_str())); cuid));
SharedHandle<Segment> segment; SharedHandle<Segment> segment;
if(piece->getLength() == 0) { if(piece->getLength() == 0) {
segment.reset(new GrowSegment(piece)); segment.reset(new GrowSegment(piece));

View File

@ -56,7 +56,7 @@ void SimpleBtMessage::send() {
} }
if(!isSendingInProgress()) { if(!isSendingInProgress()) {
A2_LOG_INFO(fmt(MSG_SEND_PEER_MESSAGE, A2_LOG_INFO(fmt(MSG_SEND_PEER_MESSAGE,
util::itos(getCuid()).c_str(), getCuid(),
getPeer()->getIPAddress().c_str(), getPeer()->getIPAddress().c_str(),
getPeer()->getPort(), getPeer()->getPort(),
toString().c_str())); toString().c_str()));

View File

@ -174,8 +174,8 @@ void TrackerWatcherCommand::processTrackerResponse
command->setPeerStorage(peerStorage_); command->setPeerStorage(peerStorage_);
command->setPieceStorage(pieceStorage_); command->setPieceStorage(pieceStorage_);
e_->addCommand(command); e_->addCommand(command);
A2_LOG_DEBUG(fmt("CUID#%s - Adding new command CUID#%s", A2_LOG_DEBUG(fmt("CUID#%lld - Adding new command CUID#%s",
util::itos(getCuid()).c_str(), getCuid(),
util::itos(peer->usedBy()).c_str())); util::itos(peer->usedBy()).c_str()));
} }
} }

View File

@ -38,70 +38,70 @@
#include "common.h" #include "common.h"
#define MSG_SEGMENT_DOWNLOAD_COMPLETED \ #define MSG_SEGMENT_DOWNLOAD_COMPLETED \
"CUID#%s - The download for one segment completed successfully." "CUID#%lld - The download for one segment completed successfully."
#define MSG_NO_SEGMENT_AVAILABLE "CUID#%s - No segment available." #define MSG_NO_SEGMENT_AVAILABLE "CUID#%lld - No segment available."
#define MSG_CONNECTING_TO_SERVER "CUID#%s - Connecting to %s:%d" #define MSG_CONNECTING_TO_SERVER "CUID#%lld - Connecting to %s:%d"
#define MSG_REDIRECT "CUID#%s - Redirecting to %s" #define MSG_REDIRECT "CUID#%lld - Redirecting to %s"
#define MSG_SENDING_REQUEST "CUID#%s - Requesting:\n%s" #define MSG_SENDING_REQUEST "CUID#%lld - Requesting:\n%s"
#define MSG_RECEIVE_RESPONSE "CUID#%s - Response received:\n%s" #define MSG_RECEIVE_RESPONSE "CUID#%lld - Response received:\n%s"
#define MSG_DOWNLOAD_ABORTED "CUID#%s - Download aborted. URI=%s" #define MSG_DOWNLOAD_ABORTED "CUID#%lld - Download aborted. URI=%s"
#define MSG_RESTARTING_DOWNLOAD "CUID#%s - Restarting the download. URI=%s" #define MSG_RESTARTING_DOWNLOAD "CUID#%lld - Restarting the download. URI=%s"
#define MSG_TORRENT_DOWNLOAD_ABORTED "CUID#%s - Download aborted." #define MSG_TORRENT_DOWNLOAD_ABORTED "CUID#%lld - Download aborted."
#define MSG_MAX_TRY \ #define MSG_MAX_TRY \
"CUID#%s - %d times attempted, but no success. Download aborted." "CUID#%lld - %d times attempted, but no success. Download aborted."
#define MSG_SEND_PEER_MESSAGE "CUID#%s - To: %s:%d %s" #define MSG_SEND_PEER_MESSAGE "CUID#%lld - To: %s:%d %s"
#define MSG_RECEIVE_PEER_MESSAGE "CUID#%s - From: %s:%d %s" #define MSG_RECEIVE_PEER_MESSAGE "CUID#%lld - From: %s:%d %s"
#define MSG_GOT_NEW_PIECE "CUID#%s - we got new piece. index=%lu" #define MSG_GOT_NEW_PIECE "CUID#%lld - we got new piece. index=%lu"
#define MSG_GOT_WRONG_PIECE "CUID#%s - we got wrong piece. index=%lu" #define MSG_GOT_WRONG_PIECE "CUID#%lld - we got wrong piece. index=%lu"
#define MSG_DOWNLOAD_NOT_COMPLETE "CUID#%s - Download not complete: %s" #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_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 \ #define MSG_NAME_RESOLUTION_COMPLETE \
"CUID#%s - Name resolution complete: %s -> %s" "CUID#%lld - Name resolution complete: %s -> %s"
#define MSG_NAME_RESOLUTION_FAILED \ #define MSG_NAME_RESOLUTION_FAILED \
"CUID#%s - Name resolution for %s failed:%s" "CUID#%lld - Name resolution for %s failed:%s"
#define MSG_DNS_CACHE_HIT "CUID#%s - DNS cache hit: %s -> %s" #define MSG_DNS_CACHE_HIT "CUID#%lld - DNS cache hit: %s -> %s"
#define MSG_CONNECTING_TO_PEER "CUID#%s - Connecting to the peer %s" #define MSG_CONNECTING_TO_PEER "CUID#%lld - Connecting to the peer %s"
#define MSG_PIECE_RECEIVED \ #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" " 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 \ #define MSG_REJECT_PIECE_CHOKED \
"CUID#%s - Reject piece message in queue because the peer has been choked." \ "CUID#%lld - Reject piece message in queue because the peer has been" \
" index=%lu, begin=%u, length=%u" " choked. index=%lu, begin=%u, length=%u"
#define MSG_REJECT_PIECE_CANCEL \ #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" " index=%lu, begin=%u, length=%u"
#define MSG_FILE_VALIDATION_FAILURE \ #define MSG_FILE_VALIDATION_FAILURE \
"CUID#%s - Exception caught while validating file integrity." "CUID#%lld - Exception caught while validating file integrity."
#define MSG_PEER_INTERESTED "CUID#%s - Interested in the peer" #define MSG_PEER_INTERESTED "CUID#%lld - Interested in the peer"
#define MSG_PEER_NOT_INTERESTED "CUID#%s - Not interested in the peer" #define MSG_PEER_NOT_INTERESTED "CUID#%lld - Not interested in the peer"
#define MSG_DELETING_REQUEST_SLOT "CUID#%s - Deleting request slot index=%lu," \ #define MSG_DELETING_REQUEST_SLOT "CUID#%lld - Deleting request slot" \
" begin=%u, blockIndex=%lu" " index=%lu, begin=%u, blockIndex=%lu"
#define MSG_DELETING_REQUEST_SLOT_CHOKED "CUID#%s - Deleting request slot" \ #define MSG_DELETING_REQUEST_SLOT_CHOKED "CUID#%lld - Deleting request slot" \
" index=%lu, begin=%u, blockIndex=%lu because localhost got choked." " 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" " 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." " index=%lu, begin=%u, blockIndex=%lu because the block has been acquired."
#define MSG_FAST_EXTENSION_ENABLED "CUID#%s - Fast extension enabled." #define MSG_FAST_EXTENSION_ENABLED "CUID#%lld - Fast extension enabled."
#define MSG_EXTENDED_MESSAGING_ENABLED "CUID#%s - Extended Messaging enabled." #define MSG_EXTENDED_MESSAGING_ENABLED "CUID#%lld - Extended Messaging enabled."
#define MSG_FILE_ALLOCATION_FAILURE \ #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 \ #define MSG_CONTENT_DISPOSITION_DETECTED \
"CUID#%s - Content-Disposition detected. Use %s as filename" "CUID#%lld - Content-Disposition detected. Use %s as filename"
#define MSG_PEER_BANNED "CUID#%s - Peer %s:%d banned." #define MSG_PEER_BANNED "CUID#%lld - Peer %s:%d banned."
#define MSG_LISTENING_PORT \ #define MSG_LISTENING_PORT \
"CUID#%s - Using port %d for accepting new connections" "CUID#%lld - Using port %d for accepting new connections"
#define MSG_BIND_FAILURE "CUID#%s - An error occurred while binding port=%d" #define MSG_BIND_FAILURE "CUID#%lld - An error occurred while binding port=%d"
#define MSG_INCOMING_PEER_CONNECTION \ #define MSG_INCOMING_PEER_CONNECTION \
"CUID#%s - Incoming connection, adding new command CUID#%s" "CUID#%lld - Incoming connection, adding new command CUID#%s"
#define MSG_ACCEPT_FAILURE "CUID#%s - Error in accepting connection" #define MSG_ACCEPT_FAILURE "CUID#%lld - Error in accepting connection"
#define MSG_TRACKER_RESPONSE_PROCESSING_FAILED \ #define MSG_TRACKER_RESPONSE_PROCESSING_FAILED \
"CUID#%s - Error occurred while processing tracker response." "CUID#%lld - Error occurred while processing tracker response."
#define MSG_DHT_ENABLED_PEER "CUID#%s - The peer is DHT-enabled." #define MSG_DHT_ENABLED_PEER "CUID#%lld - The peer is DHT-enabled."
#define MSG_CONNECT_FAILED_AND_RETRY \ #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_UNRECOGNIZED_URI _("Unrecognized URI or unsupported protocol: %s")
#define MSG_TRACKER_WARNING_MESSAGE _("Tracker returned warning message: %s") #define MSG_TRACKER_WARNING_MESSAGE _("Tracker returned warning message: %s")
@ -127,7 +127,7 @@
#define MSG_VALIDATING_FILE _("Validating file %s") #define MSG_VALIDATING_FILE _("Validating file %s")
#define MSG_ALLOCATION_COMPLETED _("%ld seconds to allocate %s byte(s)") #define MSG_ALLOCATION_COMPLETED _("%ld seconds to allocate %s byte(s)")
#define MSG_FILE_ALLOCATION_DISPATCH \ #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_METALINK_QUEUEING _("Metalink: Queueing %s for download.")
#define MSG_FILE_DOWNLOAD_COMPLETED _("Download complete: %s") #define MSG_FILE_DOWNLOAD_COMPLETED _("Download complete: %s")
#define MSG_SEEDING_END _("Seeding is over.") #define MSG_SEEDING_END _("Seeding is over.")