mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-26 04:28:00 +01:00
JIBB works
This commit is contained in:
parent
c4ef2c9552
commit
a101de29fd
3 changed files with 37 additions and 38 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue