|
|
|
@ -284,7 +284,7 @@ public enum OnionRequestAPI {
|
|
|
|
internal static func sendOnionRequest(with payload: JSON, to destination: Destination, isJSONRequired: Bool = true) -> Promise<JSON> {
|
|
|
|
internal static func sendOnionRequest(with payload: JSON, to destination: Destination, isJSONRequired: Bool = true) -> Promise<JSON> {
|
|
|
|
let (promise, seal) = Promise<JSON>.pending()
|
|
|
|
let (promise, seal) = Promise<JSON>.pending()
|
|
|
|
var guardSnode: Snode!
|
|
|
|
var guardSnode: Snode!
|
|
|
|
DispatchQueue.global(qos: .userInitiated).async {
|
|
|
|
SnodeAPI.workQueue.async { // Avoid race conditions on `guardSnodes` and `paths`
|
|
|
|
buildOnion(around: payload, targetedAt: destination).done2 { intermediate in
|
|
|
|
buildOnion(around: payload, targetedAt: destination).done2 { intermediate in
|
|
|
|
guardSnode = intermediate.guardSnode
|
|
|
|
guardSnode = intermediate.guardSnode
|
|
|
|
let url = "\(guardSnode.address):\(guardSnode.port)/onion_req"
|
|
|
|
let url = "\(guardSnode.address):\(guardSnode.port)/onion_req"
|
|
|
|
|