summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/FileTransfer/IncomingJingleFileTransfer.cpp')
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
index 0871568..35f6bea 100644
--- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
@@ -47,71 +47,71 @@ IncomingJingleFileTransfer::IncomingJingleFileTransfer(
receivedBytes(0),
s5bRegistry(registry),
s5bProxy(proxy),
remoteTransportCandidateSelectFinished(false),
localTransportCandidateSelectFinished(false),
serverSession(0) {
candidateSelector = candidateSelectorFactory->createCandidateSelector();
candidateSelector->onRemoteTransportCandidateSelectFinished.connect(boost::bind(&IncomingJingleFileTransfer::handleRemoteTransportCandidateSelectFinished, this, _1));
candidateGenerator = candidateGeneratorFactory->createCandidateGenerator();
candidateGenerator->onLocalTransportCandidatesGenerated.connect(boost::bind(&IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated, this, _1));
session->onTransportInfoReceived.connect(boost::bind(&IncomingJingleFileTransfer::handleTransportInfoReceived, this, _1, _2));
session->onTransportReplaceReceived.connect(boost::bind(&IncomingJingleFileTransfer::handleTransportReplaceReceived, this, _1, _2));
session->onSessionTerminateReceived.connect(boost::bind(&IncomingJingleFileTransfer::handleSessionTerminateReceived, this, _1));
session->onSessionInfoReceived.connect(boost::bind(&IncomingJingleFileTransfer::handleSessionInfoReceived, this, _1));
description = initialContent->getDescription<JingleFileTransferDescription>();
assert(description);
assert(description->getOffers().size() == 1);
StreamInitiationFileInfo fileInfo = description->getOffers().front();
fileSizeInBytes = fileInfo.getSize();
filename = fileInfo.getName();
hash = fileInfo.getHash();
algo = fileInfo.getAlgo();
waitOnHashTimer = timerFactory->createTimer(5000);
waitOnHashTimer->onTick.connect(boost::bind(&IncomingJingleFileTransfer::finishOffTransfer, this));
}
IncomingJingleFileTransfer::~IncomingJingleFileTransfer() {
stream->onWrite.disconnect(boost::bind(&IncrementalBytestreamHashCalculator::feedData, hashCalculator, _1));
delete hashCalculator;
- session->onSessionTerminateReceived.disconnect(boost::bind(&IncomingJingleFileTransfer::handleSessionTerminateReceived, this));
+ session->onSessionTerminateReceived.disconnect(boost::bind(&IncomingJingleFileTransfer::handleSessionTerminateReceived, this, _1));
session->onTransportReplaceReceived.disconnect(boost::bind(&IncomingJingleFileTransfer::handleTransportReplaceReceived, this, _1, _2));
session->onTransportInfoReceived.disconnect(boost::bind(&IncomingJingleFileTransfer::handleTransportInfoReceived, this, _1, _2));
candidateGenerator->onLocalTransportCandidatesGenerated.disconnect(boost::bind(&IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated, this, _1));
delete candidateGenerator;
candidateSelector->onRemoteTransportCandidateSelectFinished.disconnect(boost::bind(&IncomingJingleFileTransfer::handleRemoteTransportCandidateSelectFinished, this, _1));
delete candidateSelector;
}
void IncomingJingleFileTransfer::accept(WriteBytestream::ref stream) {
assert(!this->stream);
this->stream = stream;
hashCalculator = new IncrementalBytestreamHashCalculator( algo == "md5" || hash.empty() , algo == "sha-1" || hash.empty() );
stream->onWrite.connect(boost::bind(&IncrementalBytestreamHashCalculator::feedData, hashCalculator, _1));
stream->onWrite.connect(boost::bind(&IncomingJingleFileTransfer::handleWriteStreamDataReceived, this, _1));
onStateChange(FileTransfer::State(FileTransfer::State::Negotiating));
if (JingleIBBTransportPayload::ref ibbTransport = initialContent->getTransport<JingleIBBTransportPayload>()) {
SWIFT_LOG(debug) << "Got IBB transport payload!" << std::endl;
setActiveTransport(createIBBTransport(ibbTransport));
session->sendAccept(getContentID(), initialContent->getDescriptions()[0], ibbTransport);
}
else if (JingleS5BTransportPayload::ref s5bTransport = initialContent->getTransport<JingleS5BTransportPayload>()) {
SWIFT_LOG(debug) << "Got S5B transport payload!" << std::endl;
state = CreatingInitialTransports;
s5bSessionID = s5bTransport->getSessionID().empty() ? idGenerator.generateID() : s5bTransport->getSessionID();
s5bDestination = SOCKS5BytestreamRegistry::getHostname(s5bSessionID, ourJID, session->getInitiator());
s5bRegistry->addWriteBytestream(s5bDestination, stream);
fillCandidateMap(theirCandidates, s5bTransport);
candidateSelector->addRemoteTransportCandidates(s5bTransport);
candidateSelector->setRequesterTargtet(session->getInitiator(), ourJID);
s5bTransport->setSessionID(s5bSessionID);
candidateGenerator->generateLocalTransportCandidates(s5bTransport);
}