mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Some debug output and small fixes
This commit is contained in:
parent
9d6a858b23
commit
3058ebe8b9
4 changed files with 17 additions and 11 deletions
|
@ -143,6 +143,15 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
||||||
|
|
||||||
state = State.active;
|
state = State.active;
|
||||||
|
|
||||||
|
try {
|
||||||
|
jutil.sendSessionAccept(getInitiator(), sid, getContents().get(0).getCreator(),
|
||||||
|
getContents().get(0).getName(), JingleContent.Senders.initiator, file,
|
||||||
|
transportSession.createTransport());
|
||||||
|
} catch (SmackException.NotConnectedException | SmackException.NoResponseException |
|
||||||
|
XMPPException.XMPPErrorException | InterruptedException e) {
|
||||||
|
LOGGER.log(Level.WARNING, "Could not send session-accept.", e);
|
||||||
|
}
|
||||||
|
|
||||||
transportSession.initiateIncomingSession(new JingleTransportInitiationCallback() {
|
transportSession.initiateIncomingSession(new JingleTransportInitiationCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSessionInitiated(BytestreamSession bytestreamSession) {
|
public void onSessionInitiated(BytestreamSession bytestreamSession) {
|
||||||
|
@ -153,18 +162,9 @@ public class IncomingJingleFileOffer extends JingleFileTransferSession implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onException(Exception e) {
|
public void onException(Exception e) {
|
||||||
|
LOGGER.log(Level.SEVERE, "EXCEPTION IN INCOMING SESSION: ", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
|
||||||
jutil.sendSessionAccept(getInitiator(), sid, getContents().get(0).getCreator(),
|
|
||||||
getContents().get(0).getName(), JingleContent.Senders.initiator, file,
|
|
||||||
transportSession.createTransport());
|
|
||||||
} catch (SmackException.NotConnectedException | SmackException.NoResponseException |
|
|
||||||
XMPPException.XMPPErrorException | InterruptedException e) {
|
|
||||||
LOGGER.log(Level.WARNING, "Could not send session-accept.", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class OutgoingJingleFileOffer extends JingleFileTransferSession {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onException(Exception e) {
|
public void onException(Exception e) {
|
||||||
LOGGER.log(Level.SEVERE, "Cannot create outgoing Bytestream session: ", e);
|
LOGGER.log(Level.SEVERE, "EXCEPTION IN OUTGOING SESSION:", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class ReceiveTask implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
LOGGER.log(Level.INFO, "Start ReceiveTask");
|
||||||
JingleFileTransferChild transfer = (JingleFileTransferChild) fileTransfer.getJingleContentDescriptionChildren().get(0);
|
JingleFileTransferChild transfer = (JingleFileTransferChild) fileTransfer.getJingleContentDescriptionChildren().get(0);
|
||||||
FileOutputStream outputStream = null;
|
FileOutputStream outputStream = null;
|
||||||
InputStream inputStream;
|
InputStream inputStream;
|
||||||
|
@ -68,12 +69,14 @@ public class ReceiveTask implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream.write(filebuf);
|
outputStream.write(filebuf);
|
||||||
|
LOGGER.log(Level.INFO, "Received " + read + " bytes.");
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.log(Level.SEVERE, "Error while receiving data: ", e);
|
LOGGER.log(Level.SEVERE, "Error while receiving data: ", e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
session.close();
|
session.close();
|
||||||
|
LOGGER.log(Level.INFO, "Session closed.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.log(Level.SEVERE, "Could not close InputStream.", e);
|
LOGGER.log(Level.SEVERE, "Could not close InputStream.", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class SendTask implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
LOGGER.log(Level.INFO, "Start SendTask");
|
||||||
InputStream inputStream;
|
InputStream inputStream;
|
||||||
OutputStream outputStream;
|
OutputStream outputStream;
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ public class SendTask implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream.write(filebuf);
|
outputStream.write(filebuf);
|
||||||
|
LOGGER.log(Level.INFO, "Written " + r + " bytes.");
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
LOGGER.log(Level.SEVERE, "Could not send file: " + e, e);
|
LOGGER.log(Level.SEVERE, "Could not send file: " + e, e);
|
||||||
|
@ -64,6 +66,7 @@ public class SendTask implements Runnable {
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
session.close();
|
session.close();
|
||||||
|
LOGGER.log(Level.INFO, "Session closed.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.log(Level.SEVERE, "Could not close session.", e);
|
LOGGER.log(Level.SEVERE, "Could not close session.", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue