1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 20:42:06 +01:00

JIBB works

This commit is contained in:
vanitasvitae 2017-06-24 12:14:05 +02:00
parent c4ef2c9552
commit a101de29fd
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 37 additions and 38 deletions

View file

@ -135,29 +135,28 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
return;
}
queued.add(threadPool.submit(new Runnable() {
state = State.active;
transportSession.initiateIncomingSession(new JingleTransportInitiationCallback() {
@Override
public void run() {
try {
state = State.active;
transportSession.initiateIncomingSession(new JingleTransportInitiationCallback() {
@Override
public void onSessionInitiated(BytestreamSession bytestreamSession) {
receivingThread = new ReceiveTask(bytestreamSession, file, target);
queued.add(threadPool.submit(receivingThread));
}
@Override
public void onException(Exception e) {
}
});
jutil.sendSessionAccept(getInitiator(), sid, creator, name, JingleContent.Senders.initiator, file, transportSession.createTransport());
} catch (SmackException.NotConnectedException | SmackException.NoResponseException | XMPPException.XMPPErrorException | InterruptedException e) {
LOGGER.log(Level.SEVERE, "Could not send session-accept: " + e, e);
}
public void onSessionInitiated(BytestreamSession bytestreamSession) {
LOGGER.log(Level.INFO, "BEFORE THREAD START!");
receivingThread = new ReceiveTask(bytestreamSession, file, target);
queued.add(threadPool.submit(receivingThread));
LOGGER.log(Level.INFO,"AFTER THREAD START!");
}
}));
@Override
public void onException(Exception e) {
}
});
try {
jutil.sendSessionAccept(getInitiator(), sid, creator, name, JingleContent.Senders.initiator, file, transportSession.createTransport());
} catch (SmackException.NotConnectedException | SmackException.NoResponseException | XMPPException.XMPPErrorException | InterruptedException e) {
e.printStackTrace();
}
}
@Override

View file

@ -103,24 +103,22 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
LOGGER.log(Level.INFO, "Session was accepted. Initiate Bytestream.");
state = State.active;
queued.add(threadPool.submit(new Runnable() {
@Override
public void run() {
transportSession.initiateOutgoingSession(new JingleTransportInitiationCallback() {
@Override
public void onSessionInitiated(final BytestreamSession session) {
LOGGER.log(Level.INFO, "BytestreamSession initiated. Start transfer.");
sendingThread = new SendTask(session, source);
queued.add(threadPool.submit(sendingThread));
}
@Override
public void onException(Exception e) {
LOGGER.log(Level.SEVERE, "Cannot create outgoing Bytestream session: ", e);
}
});
transportSession.processJingle(sessionAccept);
transportSession.initiateOutgoingSession(new JingleTransportInitiationCallback() {
@Override
public void onSessionInitiated(final BytestreamSession session) {
LOGGER.log(Level.INFO, "BytestreamSession initiated. Start transfer.");
sendingThread = new SendTask(session, source);
queued.add(threadPool.submit(sendingThread));
}
}));
@Override
public void onException(Exception e) {
LOGGER.log(Level.SEVERE, "Cannot create outgoing Bytestream session: ", e);
}
});
return jutil.createAck(sessionAccept);
}

View file

@ -89,7 +89,7 @@ public class JingleIBBTransportSession extends JingleTransportSession<JingleIBBT
public void incomingBytestreamRequest(BytestreamRequest request) {
if (request.getFrom().asFullJidIfPossible().equals(jingleSession.get().getRemote())
&& request.getSessionID().equals(ibbTransport.getSessionId())) {
LOGGER.log(Level.INFO,"MATCH! Create bytesteam session.");
BytestreamSession session;
try {
@ -99,6 +99,8 @@ public class JingleIBBTransportSession extends JingleTransportSession<JingleIBBT
return;
}
callback.onSessionInitiated(session);
} else {
LOGGER.log(Level.SEVERE, "MISSMATCH");
}
}
});