8000 Merge pull request #7694 from DavePutz/issue_7054 · adafruit/circuitpython@21305e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 21305e3

Browse files
authored
Merge pull request #7694 from DavePutz/issue_7054
Fix for issue #7054 by avoiding recursive calls to websocket_background.
2 parents 23818e9 + 59f56a4 commit 21305e3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

supervisor/shared/web_workflow/websocket.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ typedef struct {
5252
// interrupt character.
5353
STATIC ringbuf_t _incoming_ringbuf;
5454
STATIC uint8_t _buf[16];
55+
// make sure background is not called recursively
56+
STATIC bool in_web_background = false;
5557

5658
static _websocket cp_serial;
5759

@@ -244,6 +246,10 @@ void websocket_background(void) {
244246
if (!websocket_connected()) {
245247
return;
246248
}
249+
if (in_web_background) {
250+
return;
251+
}
252+
in_web_background = true;
247253
uint8_t c;
248254
while (ringbuf_num_empty(&_incoming_ringbuf) > 0 &&
249255
_read_next_payload_byte(&c)) {
@@ -253,4 +259,5 @@ void websocket_background(void) {
253259
}
254260
ringbuf_put(&_incoming_ringbuf, c);
255261
}
262+
in_web_background = false;
256263
}

0 commit comments

Comments
 (0)
0