disconnect radio regardless of MMS exception

Fixes #2498
Closes #2544
// FREEBIE
This commit is contained in:
Jake McGinty 2015-02-27 14:13:45 -08:00 committed by Moxie Marlinspike
parent ac312ff5d5
commit 96896bf8f1
2 changed files with 34 additions and 34 deletions

View File

@ -110,12 +110,12 @@ public class MmsDownloadJob extends MasterSecretJob {
Log.w(TAG, "Changing radio to MMS mode.."); Log.w(TAG, "Changing radio to MMS mode..");
radio.connect(); radio.connect();
try {
Log.w(TAG, "Downloading in MMS mode with proxy..."); Log.w(TAG, "Downloading in MMS mode with proxy...");
try { try {
retrieveAndStore(masterSecret, radio, messageId, threadId, contentLocation, retrieveAndStore(masterSecret, radio, messageId, threadId, contentLocation,
transactionId, true, true); transactionId, true, true);
radio.disconnect();
return; return;
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, e); Log.w(TAG, e);
@ -126,15 +126,16 @@ public class MmsDownloadJob extends MasterSecretJob {
try { try {
retrieveAndStore(masterSecret, radio, messageId, threadId, retrieveAndStore(masterSecret, radio, messageId, threadId,
contentLocation, transactionId, true, false); contentLocation, transactionId, true, false);
radio.disconnect();
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, e); Log.w(TAG, e);
radio.disconnect();
handleDownloadError(masterSecret, messageId, threadId, handleDownloadError(masterSecret, messageId, threadId,
MmsDatabase.Status.DOWNLOAD_SOFT_FAILURE, MmsDatabase.Status.DOWNLOAD_SOFT_FAILURE,
context.getString(R.string.MmsDownloader_error_connecting_to_mms_provider), context.getString(R.string.MmsDownloader_error_connecting_to_mms_provider),
automatic); automatic);
} }
} finally {
radio.disconnect();
}
} catch (ApnUnavailableException e) { } catch (ApnUnavailableException e) {
Log.w(TAG, e); Log.w(TAG, e);

View File

@ -118,9 +118,8 @@ public class MmsSendJob extends SendJob {
radio.connect(); radio.connect();
try { try {
MmsSendResult result = sendMms(masterSecret, radio, message, true, true); try {
radio.disconnect(); return sendMms(masterSecret, radio, message, true, true);
return result;
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, e); Log.w(TAG, e);
} }
@ -128,14 +127,14 @@ public class MmsSendJob extends SendJob {
Log.w(TAG, "Sending MMS with radio change and without proxy..."); Log.w(TAG, "Sending MMS with radio change and without proxy...");
try { try {
MmsSendResult result = sendMms(masterSecret, radio, message, true, false); return sendMms(masterSecret, radio, message, true, false);
radio.disconnect();
return result;
} catch (IOException ioe) { } catch (IOException ioe) {
Log.w(TAG, ioe); Log.w(TAG, ioe);
radio.disconnect();
throw new UndeliverableMessageException(ioe); throw new UndeliverableMessageException(ioe);
} }
} finally {
radio.disconnect();
}
} catch (MmsRadioException mre) { } catch (MmsRadioException mre) {
Log.w(TAG, mre); Log.w(TAG, mre);