| 1898 | } |
| 1899 | |
| 1900 | void |
| 1901 | Http2ConnectionState::restart_streams() |
| 1902 | { |
| 1903 | Http2Stream *s = stream_list.head; |
| 1904 | if (s) { |
| 1905 | Http2Stream *end = s; |
| 1906 | |
| 1907 | // This is a static variable, so it is shared in Http2ConnectionState instances and will get incremented in subsequent calls. |
| 1908 | // It doesn't need to be initialized with rand() nor time(), and doesn't need to be accessed with a lock, because it doesn't |
| 1909 | // need that randomness and accuracy. |
| 1910 | static uint16_t starting_point = 0; |
| 1911 | // Change the start point randomly |
| 1912 | for (int i = starting_point % total_peer_streams_count; i >= 0; --i) { |
| 1913 | end = static_cast<Http2Stream *>(end->link.next ? end->link.next : stream_list.head); |
| 1914 | } |
| 1915 | s = static_cast<Http2Stream *>(end->link.next ? end->link.next : stream_list.head); |
| 1916 | |
| 1917 | // Call send_response_body() for each streams |
| 1918 | while (s != end) { |
| 1919 | Http2Stream *next = static_cast<Http2Stream *>(s->link.next ? s->link.next : stream_list.head); |
| 1920 | if (this->get_peer_rwnd() > 0 && s->get_peer_rwnd() > 0) { |
| 1921 | SCOPED_MUTEX_LOCK(lock, s->mutex, this_ethread()); |
| 1922 | s->restart_sending(); |
| 1923 | } |
| 1924 | ink_assert(s != next); |
| 1925 | s = next; |
| 1926 | } |
| 1927 | |
| 1928 | // The above stopped at end, so we need to call send_response_body() one |
| 1929 | // last time for the stream pointed to by end. |
| 1930 | if (this->get_peer_rwnd() > 0 && s->get_peer_rwnd() > 0) { |
| 1931 | SCOPED_MUTEX_LOCK(lock, s->mutex, this_ethread()); |
| 1932 | s->restart_sending(); |
| 1933 | } |
| 1934 | |
| 1935 | ++starting_point; |
| 1936 | } |
| 1937 | } |
| 1938 | |
| 1939 | void |
| 1940 | Http2ConnectionState::restart_receiving(Http2Stream *stream) |
no test coverage detected