[En-Nut-Discussion] [PATCH 2/2] FIX: TLS when sending & receiving simultaneously
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Mon Apr 24 13:09:43 CEST 2017
>>>>> "Krzysztof" == Krzysztof Sawicki <krzysztof.sawicki at mlabs.pl> 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 at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------
More information about the En-Nut-Discussion
mailing list