Skip to content

openssl wrapper gets stuck if client is started before network is ready #5

Closed
@larsonmpdx

Description

@larsonmpdx

in my client I set up a connection using code copied from the pubsub sample, which uses the openssl wrapper:

https://github.com/aws/aws-iot-device-sdk-cpp/tree/master/samples/PubSub

if I start my program before the system's network is available then it gets stuck forever on the iot_client->connect() call (see this line for example):

https://github.com/aws/aws-iot-device-sdk-cpp/blob/master/samples/PubSub/PubSub.cpp#L181

the error returned is -300, NETWORK_TCP_CONNECT_ERROR, with a log line "TCP Connection error" which means it came from this bit of code:

https://github.com/aws/aws-iot-device-sdk-cpp/blob/master/network/OpenSSL/OpenSSLConnection.cpp#L290

and this specific system call:

https://github.com/aws/aws-iot-device-sdk-cpp/blob/master/network/OpenSSL/OpenSSLConnection.cpp#L158

I'm going to instrument the system call to get its error code. What happens is the connection fails, my program waits N seconds and retries (with a fresh network::OpenSSLConnection object), and continues to get the same error even though my computer can ping and the network is now up. If I restart my client after the network is up it works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions