Skip to content

Commit 6fa1766

Browse files
committed
Ensure background tasks are serviced during a lengthy sendall
1 parent 3b7fecc commit 6fa1766

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

shared-bindings/socketpool/Socket.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ STATIC mp_obj_t _socketpool_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
283283
}
284284
bufinfo.len -= ret;
285285
bufinfo.buf += ret;
286+
if (bufinfo.len > 0) {
287+
RUN_BACKGROUND_TASKS;
288+
// Allow user to break out of sendall with a KeyboardInterrupt.
289+
if (mp_hal_is_interrupted()) {
290+
return 0;
291+
}
292+
}
286293
}
287294
return mp_const_none;
288295
}

0 commit comments

Comments
 (0)