Merge pull request #7309 from tannewt/fix_esp_socket_block

Three small ESP web workflow fixes
This commit is contained in:
Dan Halbert 2022-12-06 17:12:45 -05:00 committed by GitHub
commit 4418f268b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -285,6 +285,7 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_
accepted->num = newsoc;
accepted->pool = self->pool;
accepted->connected = true;
lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK);
}
return newsoc;
@ -303,7 +304,6 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o
sock->pool = self->pool;
sock->connected = true;
lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK);
return sock;
} else {
mp_raise_OSError(-newsoc);

View File

@ -8,8 +8,8 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set
CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG=y
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
# end of Bootloader config
@ -72,8 +72,8 @@ CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
# end of Log output

View File

@ -57,11 +57,15 @@ static _websocket cp_serial;
void websocket_init(void) {
socketpool_socket_reset(&cp_serial.socket);
cp_serial.closed = true;
ringbuf_init(&_incoming_ringbuf, _buf, sizeof(_buf) - 1);
}
void websocket_handoff(socketpool_socket_obj_t *socket) {
if (!cp_serial.closed) {
common_hal_socketpool_socket_close(&cp_serial.socket);
}
socketpool_socket_move(socket, &cp_serial.socket);
cp_serial.closed = false;
cp_serial.opcode = 0;