~ubuntu-branches/ubuntu/oneiric/libktorrent/oneiric

« back to all changes in this revision

Viewing changes to src/utp/delaywindow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Modestas Vainius
  • Date: 2011-05-26 00:33:38 UTC
  • mfrom: (5.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110526003338-2r4zwyzn8bovsxay
Tags: 1.1.1-2
Release to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
namespace utp
29
29
{
30
30
        
31
 
        DelayWindow::DelayWindow() : lowest(0)
 
31
        DelayWindow::DelayWindow()
32
32
        {
33
33
        }
34
34
        
65
65
                
66
66
                if (!added)
67
67
                        delay_window.push_back(DelayEntry(hdr->timestamp_difference_microseconds,now));
68
 
                
 
68
 
69
69
                return delay_window.front().timestamp_difference_microseconds;
70
70
        }
71
 
        
72
 
        DelayWindow::DelayEntry* DelayWindow::findBaseDelay()
73
 
        {
74
 
                bt::Uint32 base_delay = MAX_DELAY;
75
 
                DelayEntryItr found = delay_window.end();
76
 
                DelayEntryItr itr = delay_window.begin();
77
 
                while (itr != delay_window.end())
78
 
                {
79
 
                        if (itr->timestamp_difference_microseconds < base_delay)
80
 
                        {
81
 
                                base_delay = itr->timestamp_difference_microseconds;
82
 
                                found = itr;
83
 
                        }
84
 
                        itr++;
85
 
                }
86
 
                
87
 
                if (found == delay_window.end())
88
 
                        return 0;
89
 
                else
90
 
                        return &(*found);
91
 
        }
92
 
 
93
71
}
94
72