Skip to content

Commit f9d724c

Browse files
committed
Fix retries after successful connection.
We may have set retries to 0 to enforce a timeout but the connect succeeded. When it succeeds, we want to allow retries later in case we lose signal briefly. (The callback will do this too but the connect function will override it after.) Also, remove extra code from websocket that is leftover from debugging.
1 parent c2a45c1 commit f9d724c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ports/espressif/common-hal/wifi/Radio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t
336336
return WIFI_RADIO_ERROR_NO_AP_FOUND;
337337
}
338338
return self->last_disconnect_reason;
339+
} else {
340+
// We're connected, allow us to retry if we get disconnected.
341+
self->retries_left = self->starting_retries;
339342
}
340343
return WIFI_RADIO_ERROR_NONE;
341344
}

supervisor/shared/web_workflow/websocket.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,6 @@ static void _websocket_send(_websocket *ws, const char *text, size_t len) {
248248
_send_raw(&ws->socket, extended_len, 4);
249249
}
250250
_send_raw(&ws->socket, (const uint8_t *)text, len);
251-
char copy[len];
252-
memcpy(copy, text, len);
253-
copy[len] = '\0';
254251
}
255252

256253
void websocket_write(const char *text, size_t len) {

0 commit comments

Comments
 (0)