Skip to content

Commit 4418f26

Browse files
authored
Merge pull request #7309 from tannewt/fix_esp_socket_block
Three small ESP web workflow fixes
2 parents 5cb867e + b354cec commit 4418f26

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

ports/espressif/common-hal/socketpool/Socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_
285285
accepted->num = newsoc;
286286
accepted->pool = self->pool;
287287
accepted->connected = true;
288+
lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK);
288289
}
289290

290291
return newsoc;
@@ -303,7 +304,6 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o
303304
sock->pool = self->pool;
304305
sock->connected = true;
305306

306-
lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK);
307307
return sock;
308308
} else {
309309
mp_raise_OSError(-newsoc);

ports/espressif/esp-idf-config/sdkconfig-debug.defaults

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
88
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
99
# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
1010
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
11-
# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set
12-
CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG=y
11+
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
12+
# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set
1313
# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
1414
# end of Bootloader config
1515

@@ -72,8 +72,8 @@ CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2
7272
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
7373
# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
7474
# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
75-
# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set
76-
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
75+
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
76+
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
7777
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
7878
# end of Log output
7979

supervisor/shared/web_workflow/websocket.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,15 @@ static _websocket cp_serial;
5757

5858
void websocket_init(void) {
5959
socketpool_socket_reset(&cp_serial.socket);
60+
cp_serial.closed = true;
6061

6162
ringbuf_init(&_incoming_ringbuf, _buf, sizeof(_buf) - 1);
6263
}
6364

6465
void websocket_handoff(socketpool_socket_obj_t *socket) {
66+
if (!cp_serial.closed) {
67+
common_hal_socketpool_socket_close(&cp_serial.socket);
68+
}
6569
socketpool_socket_move(socket, &cp_serial.socket);
6670
cp_serial.closed = false;
6771
cp_serial.opcode = 0;

0 commit comments

Comments
 (0)