I am connecting to a remote server by wrapping a TCP socket in a SSLContext object via the method provided in the readme. I am currently reading from the network with code that vaguely resembles the following:
@async begin
try
while true
while (eof(mySSLContext)); end
#read from mySSLContext and do other things
end
catch err
#dump stack trace and exit()
end
end
However, in certain scenarios, the server will close the connection for whatever reason. In response to this, my code ceases to respond to any input, including attempts to kill the process via Ctrl-C; I must enter task manager or kill the terminal completely to terminate the process. In the meantime, my code will begin consuming 15% of my CPU, up from an otherwise negligible amount.
Debug prints have shown that the problem seems to be caused by the eof(mySSLContext) somewhere, but I am having difficulty debugging into the package itself.
So far I have tried:
-Replacing 'eof(mySSLContext)' with 'eof(myTCPsocket)' ; however, this causes the code to block indefinitely on the eof check.
-Detecting eof or readability through other functions, such as 'isopen' or 'bytesavailable'. These do not seem to help.
-Notably, using the OpenSSL package for this exact purpose will throw an EOF error when the network stream closes; however, I tried and cannot find a way to get MbedTLS to trigger one of its error codes
I am connecting to a remote server by wrapping a TCP socket in a SSLContext object via the method provided in the readme. I am currently reading from the network with code that vaguely resembles the following:
However, in certain scenarios, the server will close the connection for whatever reason. In response to this, my code ceases to respond to any input, including attempts to kill the process via Ctrl-C; I must enter task manager or kill the terminal completely to terminate the process. In the meantime, my code will begin consuming 15% of my CPU, up from an otherwise negligible amount.
Debug prints have shown that the problem seems to be caused by the eof(mySSLContext) somewhere, but I am having difficulty debugging into the package itself.
So far I have tried: -Replacing 'eof(mySSLContext)' with 'eof(myTCPsocket)' ; however, this causes the code to block indefinitely on the eof check. -Detecting eof or readability through other functions, such as 'isopen' or 'bytesavailable'. These do not seem to help. -Notably, using the OpenSSL package for this exact purpose will throw an EOF error when the network stream closes; however, I tried and cannot find a way to get MbedTLS to trigger one of its error codes
Any help would be greatly appreciated.