Git Product home page Git Product logo

Comments (3)

francisyyan avatar francisyyan commented on June 15, 2024

Hi Ofir -- How did you conclude that the values in current_tcp_info changed unexpectedly?

In the function reinit_sending_time where the issue was opened, client_.tcp_info() will not get updated, so there will be no difference to grab a (const) reference or make a copy. To verify this, feel free to print out curr_tcp_info three times in a row anywhere in that function but make sure you are printing for the same client_.

Additionally, before every video chunk is served to a client, the tcp_info of the client will be updated with new values from the kernel, so when Line 135 is executed again next time, the tcp_info will probably have different values.

from puffer.

ofirbarak avatar ofirbarak commented on June 15, 2024

I know it sound strange but this is exactly what I tried:
If I'm printing right after declaration, 3 times in a row, I'm getting good results (I've printed all its properties - delivery_rate, cwnd, in_flight, min_rtt, rtt):

0,sdsdfsdf: Firefox on Linux, 127.0.0.1:44938
0,sdsdfsdf: connection initialized
0,sdsdfsdf: channel nbc, audio 0 32k
936228571 11 0 17 19
936228571 11 0 17 19
936228571 11 0 17 19

But if I'm printing right after declaration and after the if-block (line 176), curr_tcp_info changed:
For referenced curr_tcp_info (original code):

0,sdsdfsdf: Firefox on Linux, 127.0.0.1:44774
0,sdsdfsdf: connection initialized
0,sdsdfsdf: channel nbc, audio 0 32k
1129931034 11 0 18 19
1129931034 616078304 21854 18 19
0,sdsdfsdf: channel nbc, video 0 1920x1080-22 0.987653

4365533333 18 0 5 570
93862818819104 603531808 21854 603531808 21854
0,sdsdfsdf: channel nbc, video 180180 1920x1080-24 0.987683

But For copied curr_tcp_info:

0,sdsdfsdf: Firefox on Linux, 127.0.0.1:44510
0,sdsdfsdf: connection initialized
0,sdsdfsdf: channel nbc, audio 0 32k
1057032258 12 0 24 25
1057032258 12 0 24 25
0,sdsdfsdf: channel nbc, video 0 1920x1080-22 0.987653

4092687500 10 0 12 113
4092687500 10 0 12 113
0,sdsdfsdf: channel nbc, video 180180 1920x1080-24 0.987683

from puffer.

francisyyan avatar francisyyan commented on June 15, 2024

Sorry for the delay! I finally got a chance to test it and decided to remove the ampersand for the following reason.

With the ampersand, capturing client_.tcp_info().value(); by reference might lead to undefined behavior depending on the compiler. I am not sure if the lifetime of the returned optional object will be guaranteed to extend, so I decided to play it safe and capture by value instead, as you suggested.

Thanks a lot for catching that!

from puffer.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.