jingle rtp: improve logging and error reporting

This commit is contained in:
Daniel Gultsch 2022-08-01 10:14:49 +02:00
parent b6ce914f62
commit 62a379862e
4 changed files with 9 additions and 8 deletions

View file

@ -126,7 +126,7 @@ public abstract class AbstractParser {
return user; return user;
} }
public static String extractErrorMessage(Element packet) { public static String extractErrorMessage(final Element packet) {
final Element error = packet.findChild("error"); final Element error = packet.findChild("error");
if (error != null && error.getChildren().size() > 0) { if (error != null && error.getChildren().size() > 0) {
final List<String> errorNames = orderedElementNames(error.getChildren()); final List<String> errorNames = orderedElementNames(error.getChildren());

View file

@ -327,7 +327,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
} }
if (id.startsWith(JingleRtpConnection.JINGLE_MESSAGE_PROCEED_ID_PREFIX)) { if (id.startsWith(JingleRtpConnection.JINGLE_MESSAGE_PROCEED_ID_PREFIX)) {
final String sessionId = id.substring(JingleRtpConnection.JINGLE_MESSAGE_PROCEED_ID_PREFIX.length()); final String sessionId = id.substring(JingleRtpConnection.JINGLE_MESSAGE_PROCEED_ID_PREFIX.length());
mXmppConnectionService.getJingleConnectionManager().failProceed(account, from, sessionId); final String message = extractErrorMessage(packet);
mXmppConnectionService.getJingleConnectionManager().failProceed(account, from, sessionId, message);
return true; return true;
} }
mXmppConnectionService.markMessage(account, mXmppConnectionService.markMessage(account,

View file

@ -908,12 +908,12 @@ public class JingleConnectionManager extends AbstractConnectionManager {
} }
} }
public void failProceed(Account account, final Jid with, String sessionId) { public void failProceed(Account account, final Jid with, final String sessionId, final String message) {
final AbstractJingleConnection.Id id = final AbstractJingleConnection.Id id =
AbstractJingleConnection.Id.of(account, with, sessionId); AbstractJingleConnection.Id.of(account, with, sessionId);
final AbstractJingleConnection existingJingleConnection = connections.get(id); final AbstractJingleConnection existingJingleConnection = connections.get(id);
if (existingJingleConnection instanceof JingleRtpConnection) { if (existingJingleConnection instanceof JingleRtpConnection) {
((JingleRtpConnection) existingJingleConnection).deliverFailedProceed(); ((JingleRtpConnection) existingJingleConnection).deliverFailedProceed(message);
} }
} }

View file

@ -797,7 +797,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
} catch (final WebRTCWrapper.InitializationException e) { } catch (final WebRTCWrapper.InitializationException e) {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to initialize WebRTC"); Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to initialize WebRTC");
webRTCWrapper.close(); webRTCWrapper.close();
sendSessionTerminate(Reason.FAILED_APPLICATION); sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage());
return; return;
} }
final org.webrtc.SessionDescription sdp = final org.webrtc.SessionDescription sdp =
@ -928,10 +928,10 @@ public class JingleRtpConnection extends AbstractJingleConnection
} }
} }
void deliverFailedProceed() { void deliverFailedProceed(final String message) {
Log.d( Log.d(
Config.LOGTAG, Config.LOGTAG,
id.account.getJid().asBareJid() + ": receive message error for proceed message"); id.account.getJid().asBareJid() + ": receive message error for proceed message ("+Strings.nullToEmpty(message)+")");
if (transition(State.TERMINATED_CONNECTIVITY_ERROR)) { if (transition(State.TERMINATED_CONNECTIVITY_ERROR)) {
webRTCWrapper.close(); webRTCWrapper.close();
Log.d( Log.d(
@ -1270,7 +1270,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
webRTCWrapper.close(); webRTCWrapper.close();
final Reason reason = Reason.ofThrowable(throwable); final Reason reason = Reason.ofThrowable(throwable);
if (isInState(targetState)) { if (isInState(targetState)) {
sendSessionTerminate(reason); sendSessionTerminate(reason, throwable.getMessage());
} else { } else {
sendRetract(reason); sendRetract(reason);
} }