Skip to content

Fix WiFiStation buffer management #134

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
Oct 2, 2023
Merged

Conversation

pennam
Copy link
Contributor

@pennam pennam commented Sep 15, 2023

The issue raised trying to download a file with WiFi interface. Download stops before reaching the end of the file.

The root cause of the problem is that each time getStationRx is called the package is poped from the queue and if the subsequentially pbuf_alloc call fails the package is lost.

With the proposed changes we first check the size of the package in the queue calling peekStationRxMsgSize() and we pop it only if pbuf_alloc call is succesful, otherwise we retry the next run.

edit - Issue and proposed solution description

/cc @andreagilardoni

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Sep 15, 2023
Copy link

@Fashion-Corp Fashion-Corp left a comment

Choose a reason for hiding this comment

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

What was the problem? I also see that a variable, if_num, seem to be undefined, yet it is being called by reference in CnetIf.cpp, line 1376:

uint8_t if_num;

The outcome is not in use, however, that could change :-) Well. Let me know what is the problem with the WiFIStation buffer management, and what the bugfix does.

@pennam
Copy link
Contributor Author

pennam commented Sep 18, 2023

Sketch to reproduce the issue:

DownloadC33-PR.zip

@pennam
Copy link
Contributor Author

pennam commented Sep 18, 2023

What was the problem? I also see that a variable, if_num, seem to be undefined, yet it is being called by reference in CnetIf.cpp, line 1376:

uint8_t if_num;

The outcome is not in use, however, that could change :-) Well. Let me know what is the problem with the WiFIStation buffer management, and what the bugfix does.

@Fashion-Corp i've updated the PR description with an explanation of the problem. if_num is initialized here if a valid mesage is found, however it is not used in CWifiStation::task() so it should not be an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants