-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNS query failure in async paradigm #4
Comments
I'm sorry that I missed this issue. Is this still an issue with the recent versions, since I am relying on this code. |
Closing this, as |
I think the I have faced the same issue and found this thread after I checked with Wireshark that the request was correctly sent to the server and the server responded correctly. Please, reopen the issue. It looks like the last code that gets executed is the following: The problem, in particular, is present only when the client connection is async like here: DNSClient.connect(on: group, host: "8.8.8.8").flatMap({ client in
client.getSRVRecords(from: "_mongodb._tcp.ok0-xkvc1.mongodb.net")
}) in fact, the following test succeed: func testSRVRecordsSyncClient() throws {
let expectation = self.expectation(description: "getSRVRecords")
dnsClient.getSRVRecords(from: "_mongodb._tcp.ok0-xkvc1.mongodb.net")
.whenComplete { (result) in
switch result {
case .failure(let error):
XCTFail("\(error)")
case .success(let answers):
print(answers)
XCTAssertGreaterThanOrEqual(answers.count, 1, "The returned answers should be greater than or equal to 1")
}
expectation.fulfill()
}
self.waitForExpectations(timeout: 5, handler: nil)
}
|
@alessionossa might it be that Swift deallocated/deinit-ed the DNS client while waiting for a response? |
I just read again Notes and this is probably the case. Thank you for the fast response! I will open another issue related to |
I think this issue can now be closed |
Thanks! Will do. |
DNS request will failure with this async test as expected.
No callback is called and it shows
send failed
error in console.The text was updated successfully, but these errors were encountered: