Re: [PATCH 2/2] FIX: TLS when sending & receiving simultaneously
Uwe Bonnes <bon-1JbLm1bU5j5ZIx36JBfelj3+ndqKAYMe9FMPySWZwLkb1SvskN2V4Q@public.gmane.org> Mon, 24 Apr 2017 13:09:43 +0200
| Newsgroups | gmane.comp.hardware.microcontrollers.ethernut |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "Krzysztof" == Krzysztof Sawicki <[email protected]> writes: Krzysztof> --- nut/tls/tls1.c | 8 +++++++- 1 file changed, 7 Krzysztof> insertions(+), 1 deletion(-) Krzysztof> diff --git a/nut/tls/tls1.c b/nut/tls/tls1.c index Krzysztof> 2d76eb9..de46e6d 100644 --- a/nut/tls/tls1.c +++ Krzysztof> b/nut/tls/tls1.c @@ -936,7 +936,6 @@ static int Krzysztof> send_raw_packet(SSL *ssl, uint8_t protocol) } } Krzysztof> - SET_SSL_FLAG(SSL_NEED_RECORD); /* reset for next time */ ssl-> bm_index = 0; Krzysztof> if (protocol != PT_APP_PROTOCOL_DATA) @@ -1143,6 Krzysztof> +1142,13 @@ int basic_read(SSL *ssl, uint8_t **in_data) int Krzysztof> read_len, is_client = IS_SET_SSL_FLAG(SSL_IS_CLIENT); uint8_t Krzysztof> *buf = ssl->bm_data; Krzysztof> + uint32_t avail = 0; + NutTcpDeviceIOCtl((TCPSOCKET *) Krzysztof> ssl->client_fd, IOCTL_GETINBUFCOUNT, &avail); + if (avail < Krzysztof> ssl->need_bytes) { + NutThreadYield(); // allow another Krzysztof> thread to receive data from network + return SSL_OK; + } + Krzysztof> read_len = NutTcpReceive ((TCPSOCKET *)ssl->client_fd, Krzysztof> &buf[ssl->bm_read_index], ssl-> need_bytes-ssl->got_bytes); Krzysztof> -- 2.7.4 Can you explain the first change? For me it seems unrelated! Bye -- Uwe Bonnes bon-1JbLm1bU5j5ZIx36JBfelj3+ndqKAYMe9FMPySWZwLkb1SvskN2V4Q@public.gmane.org Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 1623569 ------- Fax. 06151 1623305 --------- _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion