Skip to content

Commit 7c00472

Browse files
vai-mikarcarlescufi
authored andcommitted
shell: telnet: Don't close the connection on ENOBUFS error
If there's not enough networking buffers at certain moment, they might become available later. So instead of closing connection (and failing assertation) sleep and retry. This avoid the following assertion failure when there's much of data to send: net_pkt: Data buffer (1500) allocation failed. net_tcp: conn: 0x20076024 packet allocation failed, len=1460 shell_telnet: Failed to send -105, shutting down ASSERTION FAIL [err == 0] @ .../subsys/shell/shell_ops.c:416 os: r0/a1: 0x00000004 r1/a2: 0x000001a0 r2/a3: 0x00000004 os: r3/a4: 0x20044380 r12/ip: 0x00001958 r14/lr: 0x080c9027 os: xpsr: 0x41000000 os: Faulting instruction address (r15/pc): 0x0811ed26 os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0 os: Current thread: 0x20045100 (shell_telnet) os: Halting system Signed-off-by: Miika Karanki <[email protected]>
1 parent 897553a commit 7c00472

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/shell/backends/shell_telnet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static void telnet_command_send_reply(uint8_t *msg, uint16_t len)
7676
ret = net_context_send(sh_telnet->client_ctx, msg, len, telnet_sent_cb,
7777
K_FOREVER, NULL);
7878

79-
if (ret == -EAGAIN) {
79+
if (ret == -EAGAIN || ret == -ENOBUFS) {
8080
k_sleep(K_MSEC(TELNET_RETRY_SEND_SLEEP_MS));
8181
continue;
8282
}
@@ -206,7 +206,7 @@ static int telnet_send(void)
206206
len, telnet_sent_cb,
207207
K_FOREVER, NULL);
208208

209-
if (ret == -EAGAIN) {
209+
if (ret == -EAGAIN || ret == -ENOBUFS) {
210210
k_sleep(K_MSEC(TELNET_RETRY_SEND_SLEEP_MS));
211211
continue;
212212
}

0 commit comments

Comments
 (0)