Kitura/Swift-SMTP

Error code: -9968(0x26f0), Operation now in progress

Opened this issue · 2 comments

I am trying to send mail through Zoho Mail using Swift-SMTP as part of a Vapor app on a Linux server.
I am sending the mail in the background thread once triggered using a HTTP request.

DispatchQueue.global().async {
    smtp.send(email){
        if let error = error{
            print(error)
        }
    }
}

The console prints out an annoyingly unhelpful "Error code: -9968(0x26f0), Operation now in progress". Please can you help me to decipher the meaning of this?

@Oliver-Binns I'm not sure, but my guess is that the connection to the SMTP server is timing out, and this is resulting in a confusing error message.

The error -9968 is defined in BlueSocket as SOCKET_ERR_CONNECT_TIMEOUT here:
https://github.com/IBM-Swift/BlueSocket/blob/1.0.24/Sources/Socket/Socket.swift#L1837

It is reported along with the 'last error' returned for the socket, which appears to be EINPROGRESS, though I'm not sure why that error would be returned. https://stackoverflow.com/questions/15243988/connect-returns-operation-now-in-progress-on-blocking-socket seems like it might be relevant. I don't know whether @billabt might have some ideas?

@Oliver-Binns I got the same error when I was running the app in simulator. Try to run it in a real device.