Changeset 393


Ignore:
Timestamp:
May 24, 2019, 11:03:14 AM (15 months ago)
Author:
coas-nagasima
Message:

WolfSLLのハンドシェイクで受信がないときタイムアウトするよう変更

Location:
azure_iot_hub/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • azure_iot_hub/trunk/app_iothub_client/src/client.c

    r390 r393  
    190190                                printf("failure to set option \"CURL Verbose\"\r\n");
    191191                        }
    192 #endif
     192
    193193                        unsigned int timeout = 241000;
    194194                        // Because it can poll "after 9 seconds" polls will happen effectively // at ~10 seconds.
     
    206206                                printf("failure to set option \"MinimumPollingTime\"\r\n");
    207207                        }
    208 
     208#endif
    209209#ifdef SET_TRUSTED_CERT_IN_SAMPLES
    210210                        // For mbed add the certificate information
  • azure_iot_hub/trunk/azure_iothub/c-utility/adapters/tlsio_wolfssl.c

    r389 r393  
    5252    char* x509privatekey;
    5353    int wolfssl_device_id;
     54    size_t socket_reads;
    5455} TLS_IO_INSTANCE;
    5556
    5657STATIC_VAR_UNUSED const char* const OPTION_WOLFSSL_SET_DEVICE_ID = "SetDeviceId";
    57 static const size_t SOCKET_READ_LIMIT = 5;
     58static const size_t SOCKET_READ_LIMIT = 30000; // 30,000 ms ?
    5859
    5960/*this function will clone an option given by name and value*/
     
    256257        int res;
    257258        tls_io_instance->tlsio_state = TLSIO_STATE_IN_HANDSHAKE;
     259        tls_io_instance->socket_reads = 0;
    258260
    259261        res = wolfSSL_connect(tls_io_instance->ssl);
     
    352354        TLS_IO_INSTANCE* tls_io_instance = (TLS_IO_INSTANCE*)context;
    353355        unsigned char* new_socket_io_read_bytes;
    354         size_t socket_reads = 0;
    355356
    356357        AZURE_UNREFERENCED_PARAMETER(ssl);
    357         while (tls_io_instance->socket_io_read_byte_count == 0 && socket_reads < SOCKET_READ_LIMIT)
    358         {
     358        if (tls_io_instance->socket_io_read_byte_count == 0)
     359        {
     360            if (tls_io_instance->socket_reads >= SOCKET_READ_LIMIT) {
     361                return WOLFSSL_CBIO_ERR_TIMEOUT;
     362            }
    359363            xio_dowork(tls_io_instance->socket_io);
    360             if (tls_io_instance->tlsio_state != TLSIO_STATE_IN_HANDSHAKE)
    361             {
    362                 break;
    363             }
    364             socket_reads++;
     364            if (tls_io_instance->tlsio_state == TLSIO_STATE_IN_HANDSHAKE)
     365            {
     366                tls_io_instance->socket_reads++;
     367            }
    365368        }
    366369
Note: See TracChangeset for help on using the changeset viewer.