Ethernet problem, application crash, problem in NutTcpReceive
Michael Fischer <[email protected]> Sun, 2 Dec 2018 17:18:24 +0100
| Newsgroups | gmane.comp.hardware.microcontrollers.ethernut |
|---|---|
| Message-ID | <[email protected]> |
Hello Uwe,
>I compiled for the STM32F746 Discovery and can start and stop iperf2
>runs without crashes. Do crashes happen for you on the F7 disco?
I can reproduce the crash here too with the F7 disco board. With the patch it works.
Attached is my patch too.
Best regards,
Michael
-------------- next part --------------
diff -Naur nut-r6730/nut/net/tcpsock.c nut-r6730-new/nut/net/tcpsock.c
--- nut-r6730/nut/net/tcpsock.c 2017-04-13 16:05:46.000000000 +0200
+++ nut-r6730-new/nut/net/tcpsock.c 2018-12-02 17:11:52.662014000 +0100
@@ -637,6 +637,14 @@
return 0;
}
+
+ /* Check again for terminated connection with empty buffer */
+ if ((sock->so_state != TCPS_ESTABLISHED) && (NULL == sock->so_rx_buf)) {
+ sock->so_last_error = ENOTCONN;
+ return -1;
+ }
+
+
if (size > sock->so_rx_cnt - sock->so_rd_cnt)
size = sock->so_rx_cnt - sock->so_rd_cnt;
if (size) {
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion