 }
 
 extension KBAPIConnection: KBAPIConnectionProtocol {
+	open var isCancelled: Bool {
+		return self.taskWasCancelled || (self.taskWrapper.isTaskValid && (self.task.state == .canceling));
+	}
+	
 	open func cancel () {
+		guard !self.isCancelled else {
+			return;
+		}
+		self.taskWasCancelled = true;
 		self.task.cancel ();
 	}
 }

		return KBAPIConnectionQueue;
	}
	
	private var taskWrapper: SessionTaskWrapper;
	
	open class func withRequest (_ request: Request) -> KBAPIConnection {

import Foundation

public protocol KBAPIConnectionProtocol: AnyObject {
	var isCancelled: Bool { get }
	
	func cancel ();
}

