MQTTClient select timeout cleanup (closes #123)
Also sets example task priorities to maximum 2, as higher priorities seem to mess with the network stack.
This commit is contained in:
parent
0734fa4166
commit
9b21c54fc5
2 changed files with 6 additions and 8 deletions
|
@ -216,6 +216,6 @@ void user_init(void)
|
|||
vSemaphoreCreateBinary(wifi_alive);
|
||||
publish_queue = xQueueCreate(3, PUB_MSG_LEN);
|
||||
xTaskCreate(&wifi_task, (int8_t *)"wifi_task", 256, NULL, 2, NULL);
|
||||
xTaskCreate(&beat_task, (int8_t *)"beat_task", 256, NULL, 3, NULL);
|
||||
xTaskCreate(&mqtt_task, (int8_t *)"mqtt_task", 1024, NULL, 4, NULL);
|
||||
xTaskCreate(&beat_task, (int8_t *)"beat_task", 256, NULL, 2, NULL);
|
||||
xTaskCreate(&mqtt_task, (int8_t *)"mqtt_task", 1024, NULL, 2, NULL);
|
||||
}
|
||||
|
|
|
@ -72,9 +72,8 @@ int mqtt_esp_read(Network* n, unsigned char* buffer, int len, int timeout_ms)
|
|||
int rcvd = 0;
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(n->my_socket, &fdset);
|
||||
// It seems tv_sec actually means FreeRTOS tick
|
||||
tv.tv_sec = timeout_ms / portTICK_RATE_MS;
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = timeout_ms / 1000;
|
||||
tv.tv_usec = (timeout_ms % 1000) * 1000;
|
||||
rc = select(n->my_socket + 1, &fdset, 0, 0, &tv);
|
||||
if ((rc > 0) && (FD_ISSET(n->my_socket, &fdset)))
|
||||
{
|
||||
|
@ -97,9 +96,8 @@ int mqtt_esp_write(Network* n, unsigned char* buffer, int len, int timeout_ms)
|
|||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(n->my_socket, &fdset);
|
||||
// It seems tv_sec actually means FreeRTOS tick
|
||||
tv.tv_sec = timeout_ms / portTICK_RATE_MS;
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = timeout_ms / 1000;
|
||||
tv.tv_usec = (timeout_ms % 1000) * 1000;
|
||||
rc = select(n->my_socket + 1, 0, &fdset, 0, &tv);
|
||||
if ((rc > 0) && (FD_ISSET(n->my_socket, &fdset)))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue