maskit commented on issue #9992:
URL: https://github.com/apache/trafficserver/issues/9992#issuecomment-1670451988

   What I probably wanted to do is avoiding nullptr checks, and `std::optional` 
was probably unavailable on ATS source code when I wrote the classes.
   
   - Http3NoError: Do not send anything
   - Http3ConnectionError: Send a connection error (the error code can be 
H3_NO_ERROR)
   - Http3StreamError (does not exist somehow): Send a stream error (the error 
code can be H3_NO_ERROR)
   
   But this (unexpectedly) required instantiating Http3NoError a lot of places. 
That's the background.
   
   So, the combination of `std::unique_ptr` and `nullptr` (i.e. the suggested 
option 1) is a simple possible solution. I'm fine with it. I just thought use 
of `std::optional` is a modern way, and I don't have a strong opinion on the 
use of `std::optional`. I agree that the combination of `std:unique_ptr` (which 
can have nullptr) and `std::optional` is confusing.
   
   Option 2 (and 3) may not be a great idea because Http3Error can contain a 
message string (the length is unlimited). The string has to be handed over to 
QUIC layer later, so managing the ownership (and the life time) of the string 
can be tricky if we copy errors.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to