Skip to content

extmod/modussl: Fix ussl read/recv/send/write errors when non-blocking (v2) #6907

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

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

dpgeorge
Copy link
Member

This is #6615 rebased, and with tests cleaned up.

int r = ssl_handshake_status(o->ssl_sock);

if (r != SSL_OK) {
ssl_display_error(r);
Copy link
Member Author

Choose a reason for hiding this comment

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

@tve I think this print was left in by accident?

Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly, I don't remember. I know that the axtls version prints errors currently and I believe I put that in to make it look the same as now. Also, I believe the errors are not very detailed and this prints more details. Probably best to remove and look at the tests output...

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll check it and probably just remove this line.

Copy link
Member Author

Choose a reason for hiding this comment

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

This code does nothing because CONFIG_SSL_DIAGNOSTICS is disabled, so I'll just remove this.


if (r != SSL_OK) {
ssl_display_error(r);
if (r == SSL_CLOSE_NOTIFY || r == SSL_ERROR_CONN_LOST) { // EOF
Copy link
Member Author

Choose a reason for hiding this comment

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

@tve to get the tests/extmod/ussl_basic.py test to pass on unix, this line should be:

if (r == SSL_CLOSE_NOTIFY) {

But I'm not sure if that's exactly correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll have to look...

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the check for SSL_ERROR_CONN_LOST. Doing this, as far as I can tell it doesn't make axtls any better or worse at the net_inet/net_hosted tests, and means it still passes the main test suite. We can fix axtls further in subsequent PRs.

@dpgeorge dpgeorge force-pushed the extmod-modussl-nonblocking branch from a8336d3 to bd650f7 Compare February 16, 2021 02:06
Also fix related problems with socket on esp32, improve docs for
wrap_socket, and add more tests.
@dpgeorge dpgeorge force-pushed the extmod-modussl-nonblocking branch from bd650f7 to 2c1299b Compare February 17, 2021 00:53
@dpgeorge dpgeorge merged commit 2c1299b into micropython:master Feb 17, 2021
@dpgeorge dpgeorge deleted the extmod-modussl-nonblocking branch February 17, 2021 01:20
@tve
Copy link
Contributor

tve commented Feb 17, 2021

Great!

Wind-stormger pushed a commit to BPI-STEAM/micropython that referenced this pull request Oct 13, 2022
…ep-sleep

allow preserving pin state during deep sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source port-esp32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants