Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit faster on recv when TLS connection closed #3759

Merged
merged 1 commit into from
Nov 25, 2020

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Nov 25, 2020

When a TLS connection is closed by the server it usually sends a
notice. We see this incoming byte with lwip_ioctl and try to read
it. The read returns 0 but we keep trying anyway. Now, we quit
trying when we get zero back. If the connection was still alive
it'd either read a byte or delay until a byte could be read.

When a TLS connection is closed by the server it usually sends a
notice. We see this incoming byte with lwip_ioctl and try to read
it. The read returns 0 but we keep trying anyway. Now, we quit
trying when we get zero back. If the connection was still alive
it'd either read a byte or delay until a byte could be read.
@tannewt tannewt added enhancement network espressif applies to multiple Espressif chips labels Nov 25, 2020
@tannewt tannewt added this to the 6.1.0 milestone Nov 25, 2020
@tannewt tannewt requested a review from jepler November 25, 2020 02:17
Copy link
Member

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I didn't understand what you were saying about "TLS internal" bytes, since I saw the call to esp_tls_get_bytes_avail, and that is documented as returning the number of application data bytes. But, there's also the call to lwp_ioctl which would return TLS internal bytes. What I'm wondering is, it seems that esp_tls_FOO calls handle the tls and non-tls cases. It makes me wonder why the lwip_ioctl is needed at all; I conjectured it was from pre-TLS-support days but that's not the case.

Feel free to merge if this lwip_ioctl concern of mine is just a distraction.

Testing performed: none

@tannewt
Copy link
Member Author

tannewt commented Nov 25, 2020

At first I didn't understand what you were saying about "TLS internal" bytes, since I saw the call to esp_tls_get_bytes_avail, and that is documented as returning the number of application data bytes. But, there's also the call to lwp_ioctl which would return TLS internal bytes. What I'm wondering is, it seems that esp_tls_FOO calls handle the tls and non-tls cases. It makes me wonder why the lwip_ioctl is needed at all; I conjectured it was from pre-TLS-support days but that's not the case.

I believe I needed lwip_ioctl for the non-TLS case to work. I could be wrong though. It's been a little while since I added this.

Feel free to merge if this lwip_ioctl concern of mine is just a distraction.

Testing performed: none

@tannewt tannewt merged commit e7bab9e into adafruit:main Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement espressif applies to multiple Espressif chips network
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants