Skip to content

NetworkUDP - in parsePacket handle previous parsed packet #10239

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

Closed
wants to merge 1 commit into from

Conversation

JAndrassy
Copy link
Contributor

@JAndrassy JAndrassy commented Aug 25, 2024

parsePacket now returns 0 if previous packet was not read. what is the logic of that?

this PR proposes to changes it to return the existing packet if it was not read yet and discard the packet if the user read some part of it.

@JAndrassy JAndrassy marked this pull request as draft August 25, 2024 17:32
Copy link
Contributor

github-actions bot commented Aug 25, 2024

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "fix:NetworkUDP - in parsePacket handle previous parsed packet":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 20 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

👋 Hello JAndrassy, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 2e50c1c

Copy link
Contributor

github-actions bot commented Aug 25, 2024

Test Results

 56 files   -  83   56 suites   - 83   4m 56s ⏱️ - 1h 38m 13s
 21 tests  -   9   21 ✅  -   9  0 💤 ±0  0 ❌ ±0 
135 runs   - 168  135 ✅  - 168  0 💤 ±0  0 ❌ ±0 

Results for commit 2e50c1c. ± Comparison against base commit cd3d0bf.

This pull request removes 9 tests.
performance.coremark.test_coremark ‑ test_coremark
performance.fibonacci.test_fibonacci ‑ test_fibonacci
performance.psramspeed.test_psramspeed ‑ test_psramspeed
performance.ramspeed.test_ramspeed ‑ test_ramspeed
performance.superpi.test_superpi ‑ test_superpi
test_touch_errors
test_touch_interrtupt
test_touch_read
validation.periman.test_periman ‑ test_periman

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Aug 25, 2024

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32S30⚠️ +920.00⚠️ +0.01000.000.00
ESP32S20⚠️ +1080.00⚠️ +0.01000.000.00
ESP32C30⚠️ +940.00⚠️ +0.01000.000.00
ESP32C60⚠️ +940.00⚠️ +0.01000.000.00
ESP32H2000.000.00000.000.00
ESP320⚠️ +1000.00⚠️ +0.01000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
Ethernet/examples/ETH_W5500_Arduino_SPI000000000000
Ethernet/examples/ETH_W5500_IDF_SPI000000000000
Ethernet/examples/ETH_WIFI_BRIDGE00000000--00
NetworkClientSecure/examples/WiFiClientInsecure00000000--00
NetworkClientSecure/examples/WiFiClientPSK00000000--00
NetworkClientSecure/examples/WiFiClientSecure00000000--00
NetworkClientSecure/examples/WiFiClientSecureEnterprise00000000--00
NetworkClientSecure/examples/WiFiClientSecureProtocolUpgrade00000000--00
NetworkClientSecure/examples/WiFiClientShowPeerCredentials00000000--00
NetworkClientSecure/examples/WiFiClientTrustOnFirstUse00000000--00
PPP/examples/PPP_Basic000000000000
PPP/examples/PPP_WIFI_BRIDGE00000000--00
WebServer/examples/AdvancedWebServer00000000--00
WebServer/examples/FSBrowser00000000--00
WebServer/examples/Filters00000000--00
WebServer/examples/HelloServer00000000--00
WebServer/examples/HttpAdvancedAuth⚠️ +920⚠️ +1040⚠️ +940⚠️ +940--⚠️ +1000
WebServer/examples/HttpAuthCallback⚠️ +920⚠️ +1000⚠️ +940⚠️ +940--⚠️ +920
WebServer/examples/HttpAuthCallbackInline⚠️ +920⚠️ +1080⚠️ +940⚠️ +940--⚠️ +1000
WebServer/examples/HttpBasicAuth⚠️ +920⚠️ +1040⚠️ +940⚠️ +940--⚠️ +1000
WebServer/examples/HttpBasicAuthSHA1⚠️ +880⚠️ +1040⚠️ +940⚠️ +940--⚠️ +920
WebServer/examples/HttpBasicAuthSHA1orBearerToken⚠️ +800⚠️ +920⚠️ +940⚠️ +940--⚠️ +1000
WebServer/examples/MultiHomedServers00000000--00
WebServer/examples/PathArgServer00000000--00
WebServer/examples/SDWebServer00000000--00
WebServer/examples/SimpleAuthentification00000000--00
WebServer/examples/UploadHugeFile00000000--00
WebServer/examples/WebServer00000000--00
WebServer/examples/WebUpdate00000000--00
WiFi/examples/FTM/FTM_Initiator00000000--00
WiFi/examples/FTM/FTM_Responder00000000--00
WiFi/examples/SimpleWiFiServer00000000--00
WiFi/examples/WPS00000000--00
WiFi/examples/WiFiAccessPoint00000000--00
WiFi/examples/WiFiBlueToothSwitch00--0000--00
WiFi/examples/WiFiClient00000000--00
WiFi/examples/WiFiClientBasic00000000--00
WiFi/examples/WiFiClientConnect00000000--00
WiFi/examples/WiFiClientEnterprise00000000--00
WiFi/examples/WiFiClientEvents00000000--00
WiFi/examples/WiFiClientStaticIP00000000--00
WiFi/examples/WiFiExtender00000000--00
WiFi/examples/WiFiIPv6⚠️ +600⚠️ +600⚠️ +600⚠️ +580--⚠️ +560
WiFi/examples/WiFiMulti00000000--00
WiFi/examples/WiFiMultiAdvanced00000000--00
WiFi/examples/WiFiScan00000000--00
WiFi/examples/WiFiScanAsync00000000--00
WiFi/examples/WiFiScanDualAntenna00000000--00
WiFi/examples/WiFiScanTime00000000--00
WiFi/examples/WiFiSmartConfig00000000--00
WiFi/examples/WiFiTelnetToSerial00000000--00
WiFi/examples/WiFiUDPClient⚠️ +920⚠️ +960⚠️ +940⚠️ +940--⚠️ +1000
Ethernet/examples/ETH_LAN8720----------00
Ethernet/examples/ETH_TLK110----------00

@JAndrassy JAndrassy force-pushed the udp_parsepacket_fix branch from e0978e4 to 2e50c1c Compare August 25, 2024 18:25
@JAndrassy JAndrassy marked this pull request as ready for review August 25, 2024 18:26
@JAndrassy JAndrassy changed the title fix:NetworkUDP - in parsePacket handle previous parsed packet NetworkUDP - in parsePacket handle previous parsed packet Aug 26, 2024
@VojtechBartoska VojtechBartoska added Area: Libraries Issue is related to Library support. Status: Review needed Issue or PR is awaiting review labels Aug 26, 2024
@@ -292,7 +292,10 @@ void NetworkUDP::flush() {}

int NetworkUDP::parsePacket() {
if (rx_buffer) {
return 0;
if (rx_buffer->full()) { // packet was not read yet
return rx_buffer->available();
Copy link
Member

Choose a reason for hiding this comment

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

can you show a benefit from returning the previous packet len more than once? If code did not care about it the first time, why should it care after that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for the library it is better than destroying it then allocate the next then destroy it ...

Copy link
Member

Choose a reason for hiding this comment

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

library will not destroy it. It will just return 0, because old packet is still there and new one was not received. The point of returning positive length is to signal that a new packet has been received. This happens only once per packet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but the PR is about not returning a zero if the packet was not read until the end

if (rx_buffer->full()) { // packet was not read yet
return rx_buffer->available();
}
clear(); // discard the rest of the packet
Copy link
Member

Choose a reason for hiding this comment

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

What will happen in you call parsePacket from one thread, but you read it's data from another?

@JAndrassy JAndrassy closed this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Libraries Issue is related to Library support. Status: Review needed Issue or PR is awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants