Ignore:
Timestamp:
Jun 22, 2021, 9:00:19 PM (3 years ago)
Author:
coas-nagasima
Message:

WolfSSLとAzure IoT SDKを更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • azure_iot_hub_f767zi/trunk/azure_iot_sdk/provisioning_client/src/prov_device_ll_client.c

    r457 r464  
    9393    TICK_COUNTER_HANDLE tick_counter;
    9494
    95     tickcounter_ms_t status_throttle;
     95    tickcounter_ms_t last_send_time_ms;
    9696    tickcounter_ms_t timeout_value;
    97     uint32_t retry_after_value;
     97    size_t retry_after_ms;
    9898
    9999    uint8_t prov_timeout;
     
    784784        PROV_INSTANCE_INFO* prov_info = (PROV_INSTANCE_INFO*)user_ctx;
    785785
    786         prov_info->retry_after_value = retry_interval;
     786        prov_info->retry_after_ms = (size_t)retry_interval * 1000; // retry_interval is in seconds.
    787787
    788788        switch (transport_status)
     
    880880            /* Codes_SRS_PROV_CLIENT_07_028: [ CLIENT_STATE_READY is the initial state after the object is created which will send a uhttp_client_open call to the http endpoint. ] */
    881881            result->prov_state = CLIENT_STATE_READY;
    882             result->retry_after_value = PROV_GET_THROTTLE_TIME;
     882            result->retry_after_ms = PROV_GET_THROTTLE_TIME * 1000;
    883883            result->prov_transport_protocol = protocol();
    884884            result->error_reason = PROV_DEVICE_RESULT_OK;
     
    931931                {
    932932                    // Ensure that we are passed the throttling time and send on the first send
    933                     (void)tickcounter_get_current_ms(result->tick_counter, &result->status_throttle);
    934                     result->status_throttle += (result->retry_after_value * 1000);
     933                    (void)tickcounter_get_current_ms(result->tick_counter, &result->last_send_time_ms);
     934                    result->last_send_time_ms += result->retry_after_ms;
    935935                }
    936936            }
     
    11191119        if (prov_info->is_connected || prov_info->prov_state == CLIENT_STATE_ERROR)
    11201120        {
     1121            tickcounter_ms_t current_time = 0;
     1122
    11211123            switch (prov_info->prov_state)
    11221124            {
    11231125                case CLIENT_STATE_REGISTER_SEND:
    1124                     /* Codes_SRS_PROV_CLIENT_07_013: [ CLIENT_STATE_REGISTER_SEND which shall construct an initial call to the service with endorsement information ] */
    1125                     if (prov_info->prov_transport_protocol->prov_transport_register(prov_info->transport_handle, prov_transport_process_json_reply, prov_transport_create_json_payload, prov_info) != 0)
    1126                     {
    1127                         LogError("Failure registering device");
    1128                         if (prov_info->error_reason == PROV_DEVICE_RESULT_OK)
    1129                         {
    1130                             prov_info->error_reason = PROV_DEVICE_RESULT_TRANSPORT;
    1131                         }
    1132                         prov_info->prov_state = CLIENT_STATE_ERROR;
    1133                     }
    1134                     else
    1135                     {
    1136                         (void)tickcounter_get_current_ms(prov_info->tick_counter, &prov_info->timeout_value);
    1137                         prov_info->prov_state = CLIENT_STATE_REGISTER_SENT;
    1138                     }
    1139                     break;
    1140 
    1141                 case CLIENT_STATE_STATUS_SEND:
    1142                 {
    1143                     tickcounter_ms_t current_time = 0;
    11441126                    if (tickcounter_get_current_ms(prov_info->tick_counter, &current_time) != 0)
    11451127                    {
     
    11501132                    else
    11511133                    {
    1152                         if ((current_time - prov_info->status_throttle) / 1000 > prov_info->retry_after_value)
     1134                        if ((current_time - prov_info->last_send_time_ms) > prov_info->retry_after_ms)
     1135                        {
     1136                            /* Codes_SRS_PROV_CLIENT_07_013: [ CLIENT_STATE_REGISTER_SEND which shall construct an initial call to the service with endorsement information ] */
     1137                            if (prov_info->prov_transport_protocol->prov_transport_register(prov_info->transport_handle, prov_transport_process_json_reply, prov_transport_create_json_payload, prov_info) != 0)
     1138                            {
     1139                                LogError("Failure registering device");
     1140                                if (prov_info->error_reason == PROV_DEVICE_RESULT_OK)
     1141                                {
     1142                                    prov_info->error_reason = PROV_DEVICE_RESULT_TRANSPORT;
     1143                                }
     1144                                prov_info->prov_state = CLIENT_STATE_ERROR;
     1145                            }
     1146                            else
     1147                            {
     1148                                (void)tickcounter_get_current_ms(prov_info->tick_counter, &prov_info->timeout_value);
     1149                                prov_info->prov_state = CLIENT_STATE_REGISTER_SENT;
     1150                            }
     1151                            prov_info->last_send_time_ms = current_time;
     1152                        }
     1153                    }
     1154                    break;
     1155
     1156                case CLIENT_STATE_STATUS_SEND:
     1157                {
     1158                    if (tickcounter_get_current_ms(prov_info->tick_counter, &current_time) != 0)
     1159                    {
     1160                        LogError("Failure getting the current time");
     1161                        prov_info->error_reason = PROV_DEVICE_RESULT_ERROR;
     1162                        prov_info->prov_state = CLIENT_STATE_ERROR;
     1163                    }
     1164                    else
     1165                    {
     1166                        if ((current_time - prov_info->last_send_time_ms) > prov_info->retry_after_ms)
    11531167                        {
    11541168                            /* Codes_SRS_PROV_CLIENT_07_026: [ Upon receiving the reply of the CLIENT_STATE_URL_REQ_SEND message from  iothub_client shall process the the reply of the CLIENT_STATE_URL_REQ_SEND state ] */
     
    11721186                                }
    11731187                            }
    1174                             prov_info->status_throttle = current_time;
     1188                            prov_info->last_send_time_ms = current_time;
    11751189                        }
    11761190                    }
     
    11831197                    if (prov_info->prov_timeout > 0)
    11841198                    {
    1185                         tickcounter_ms_t current_time = 0;
    11861199                        (void)tickcounter_get_current_ms(prov_info->tick_counter, &current_time);
    11871200                        if ((current_time - prov_info->timeout_value) / 1000 > prov_info->prov_timeout)
     
    12791292            if (value == NULL)
    12801293            {
    1281                 LogError("setting proxy options");
     1294                LogError("setting PROV_OPTION_TIMEOUT option");
    12821295                result = PROV_DEVICE_RESULT_ERROR;
    12831296            }
Note: See TracChangeset for help on using the changeset viewer.