summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2016-03-14 11:44:35 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2016-03-15 14:10:50 (GMT)
commit3dcfa7102ac07188ac0c1c8b252d45735abd31ea (patch)
tree1736bd29e6a12cffcbbd64741a26b72426b36dfa
parent63a5013833f0be3aac1d15df1ac200d48d747136 (diff)
downloadstroke-3dcfa7102ac07188ac0c1c8b252d45735abd31ea.zip
stroke-3dcfa7102ac07188ac0c1c8b252d45735abd31ea.tar.bz2
Fix handling when client certificate is missing
As per patch 'Fix swiften handling when client certificate is missing' (8405fa16b738b6ef6a5920cd9d0f5735f8b62369). Change-Id: Iec5036213d8432a3af78647470381485bfcc01e3 Test-information: Code inspection. Unit tests still pass.
-rw-r--r--src/com/isode/stroke/client/CoreClient.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/com/isode/stroke/client/CoreClient.java b/src/com/isode/stroke/client/CoreClient.java
index 010a535..6cb0d5d 100644
--- a/src/com/isode/stroke/client/CoreClient.java
+++ b/src/com/isode/stroke/client/CoreClient.java
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2015, Isode Limited, London, England. 2 * Copyright (c) 2010-2016, Isode Limited, London, England.
3 * All rights reserved. 3 * All rights reserved.
4 */ 4 */
5package com.isode.stroke.client; 5package com.isode.stroke.client;
@@ -347,11 +347,20 @@ public class CoreClient {
347 } 347 }
348 else { 348 else {
349 assert (connection_ == null); 349 assert (connection_ == null);
350 connection_ = connection;
351
352 assert (sessionStream_ == null); 350 assert (sessionStream_ == null);
353 sessionStream_ = new BasicSessionStream(StreamType.ClientStreamType, connection_, payloadParserFactories_, payloadSerializers_, networkFactories.getTLSContextFactory(), networkFactories.getTimerFactory(), options.tlsOptions); 351
354 if (certificate_ != null && !certificate_.isNull()) { 352 if (certificate_ != null && certificate_.isNull()) {
353 // Certificate can not be read so do not initialise session
354 onDisconnected.emit(new ClientError(ClientError.Type.ClientCertificateLoadError));
355 return;
356 }
357
358 connection_ = connection;
359
360 sessionStream_ =
361 new BasicSessionStream(StreamType.ClientStreamType, connection_, payloadParserFactories_, payloadSerializers_,
362 networkFactories.getTLSContextFactory(), networkFactories.getTimerFactory(), options.tlsOptions);
363 if (certificate_ != null) {
355 sessionStream_.setTLSCertificate(certificate_); 364 sessionStream_.setTLSCertificate(certificate_);
356 } 365 }
357 sessionStreamDataReadConnection_ = sessionStream_.onDataRead.connect(new Slot1<SafeByteArray>() { 366 sessionStreamDataReadConnection_ = sessionStream_.onDataRead.connect(new Slot1<SafeByteArray>() {