- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.8k
          udp: Fix UdpFramed with regards to Decode
          #1445
        
          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
  
    udp: Fix UdpFramed with regards to Decode
  
  #1445
              Conversation
UdpFramed with regards to DecodeUdpFramed with regard to Decode
      UdpFramed with regard to DecodeUdpFramed with regards to Decode
      | @JohnDoneth thanks for doing this, I'm gonna review #1444 then when that commit is approved we can port the fix into master. | 
| @LucioFranco I think this is ready for review now that #1444 has been merged! | 
| Yeah, we need to update this to the new method done in #1444 that uses decode_eof instead of just plain decode. | 
ca58f91    to
    9b3f856      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's still pending work on this.
| I am working on this again.  Edit:  Edit 2: That didn't work either. In the end I used this bit of code I found elsewhere in the project. let b = &mut *(pin.rd.bytes_mut() as *mut [MaybeUninit<u8>] as *mut [u8]); | 
| I was wondering what the status on this is? | 
| @Darksonn It was ready to be reviewed. It now needs to be caught up to master again | 
| Sorry about that. If you merge master again I'll make sure someone actually reviews it :) | 
| @JohnDoneth sorry about the delay, but anyway you could get this rebased and we can get it merged? | 
| I will put it on my todo list! | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| @JohnDoneth looks like some clippy and rustfmt failures? | 
| I think it might be CI?  | 
| The clippy error is the following. You probably forgot an  As for rustfmt, it's pretty confusing but you have to use the following command in Tokio's repositories. This has to do with our extensive use of features together with the use of macros to enable/disable them, which break rustfmt in a way that means it cannot find all the files. Check out our contributing guide for more info. | 
909d63d    to
    4c58d8a      
    Compare
  
    | @Darksonn Thanks! That was the problem. I believe this PR is ready now. ping @LucioFranco | 
| @JohnDoneth thanks a ton for following up! | 
| Looks like this change makes decoding errors useless. If we return error from  | 
| Ah, that sounds like a mistake. Consider opening a PR to fix that. | 
| Looked through the implementation once again and realized that we have to clear the buffer when packet was parsed, and then have to handle empty input as None. So we could do the same when error happens actually. | 
| But then we won't be able to distinguish zero sized packets from completely consumed packets. Probably we should check for buffer size here https://github.com/tokio-rs/tokio/blob/master/tokio-util/src/udp/frame.rs#L63 ? And then do something similar for errors? | 
Duplicate of #1444 but for master instead of the v0.1.x branch.
Should (fix) #1443 on master.
UdpFramednow attempts to continue decoding past the first discrete item if there is more data in the read buffer. I added a test for this that sends a packet with 3 lines and tests for the successful decoding of each item in turn.