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

Issue #61 fixes - stream could read incomplete data and returns too early resulting incomplete packet #63

Merged
merged 5 commits into from
Oct 4, 2020

Conversation

aldas
Copy link
Owner

@aldas aldas commented Aug 30, 2020

Logic that BinaryStreamConnection is using has problem (see #61) when stream reads incomplete packet and returns too early resulting incomplete packet.

Although modbus packet response is really small there seems to be PLCs/networks that fragment response packet to multiple TCP packet fragments. As we use PHP stream_select non-blocking way we could return with data before all bytes arrive to stream.
to overcome this StreamHandler now could use callback to check if data read from stream is enough

@aldas aldas changed the title Issue #61 fixes - stream could read incomplete packet and returns too early resulting incomplete packet Issue #61 fixes - stream could read incomplete data and returns too early resulting incomplete packet Aug 30, 2020
create codecov configuration so very small coverage changes will not be marked as failures
@codecov
Copy link

codecov bot commented Sep 27, 2020

Codecov Report

Merging #63 into master will decrease coverage by 0.04%.
The diff coverage is 96.77%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #63      +/-   ##
============================================
- Coverage     99.08%   99.04%   -0.05%     
- Complexity      752      764      +12     
============================================
  Files            63       64       +1     
  Lines          1743     1771      +28     
============================================
+ Hits           1727     1754      +27     
- Misses           16       17       +1     
Flag Coverage Δ Complexity Δ
#unittests 99.04% <96.77%> (-0.05%) 764.00 <7.00> (+12.00) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
src/Network/NonBlockingClient.php 100.00% <ø> (ø) 24.00 <0.00> (+1.00)
src/Packet/AbstractWord.php 100.00% <ø> (ø) 7.00 <0.00> (ø)
src/Packet/ModbusApplicationHeader.php 100.00% <ø> (ø) 18.00 <0.00> (ø)
src/Packet/ModbusFunction/ReadCoilsRequest.php 100.00% <ø> (ø) 9.00 <0.00> (ø)
src/Packet/ModbusFunction/ReadCoilsResponse.php 100.00% <ø> (ø) 13.00 <0.00> (ø)
...ket/ModbusFunction/ReadHoldingRegistersRequest.php 100.00% <ø> (ø) 9.00 <0.00> (ø)
...et/ModbusFunction/ReadHoldingRegistersResponse.php 100.00% <ø> (ø) 31.00 <0.00> (ø)
...acket/ModbusFunction/ReadInputDiscretesRequest.php 100.00% <ø> (ø) 1.00 <0.00> (ø)
...cket/ModbusFunction/ReadInputDiscretesResponse.php 100.00% <ø> (ø) 1.00 <0.00> (ø)
...acket/ModbusFunction/ReadInputRegistersRequest.php 100.00% <ø> (ø) 1.00 <0.00> (ø)
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0930a98...88760af. Read the comment docs.

@aldas aldas merged commit d62f769 into master Oct 4, 2020
@aldas aldas deleted the issue_61_fixes branch October 4, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant