OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 | 1605 |
1606 DCHECK(check_ping_status_pending_); | 1606 DCHECK(check_ping_status_pending_); |
1607 | 1607 |
1608 const base::TimeDelta kHungInterval = | 1608 const base::TimeDelta kHungInterval = |
1609 base::TimeDelta::FromMilliseconds(hung_interval_ms_); | 1609 base::TimeDelta::FromMilliseconds(hung_interval_ms_); |
1610 | 1610 |
1611 base::TimeTicks now = base::TimeTicks::Now(); | 1611 base::TimeTicks now = base::TimeTicks::Now(); |
1612 base::TimeDelta delay = kHungInterval - (now - received_data_time_); | 1612 base::TimeDelta delay = kHungInterval - (now - received_data_time_); |
1613 | 1613 |
1614 if (delay.InMilliseconds() < 0 || received_data_time_ < last_check_time) { | 1614 if (delay.InMilliseconds() < 0 || received_data_time_ < last_check_time) { |
1615 DCHECK(now - received_data_time_ > kHungInterval); | |
1616 CloseSessionOnError(net::ERR_SPDY_PING_FAILED, true); | 1615 CloseSessionOnError(net::ERR_SPDY_PING_FAILED, true); |
1617 return; | 1616 return; |
1618 } | 1617 } |
1619 | 1618 |
1620 // Check the status of connection after a delay. | 1619 // Check the status of connection after a delay. |
1621 MessageLoop::current()->PostDelayedTask( | 1620 MessageLoop::current()->PostDelayedTask( |
1622 FROM_HERE, | 1621 FROM_HERE, |
1623 method_factory_.NewRunnableMethod(&SpdySession::CheckPingStatus, now), | 1622 method_factory_.NewRunnableMethod(&SpdySession::CheckPingStatus, now), |
1624 delay.InMilliseconds()); | 1623 delay.InMilliseconds()); |
1625 } | 1624 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 if (it == pending_callback_map_.end()) | 1704 if (it == pending_callback_map_.end()) |
1706 return; | 1705 return; |
1707 | 1706 |
1708 OldCompletionCallback* callback = it->second.callback; | 1707 OldCompletionCallback* callback = it->second.callback; |
1709 int result = it->second.result; | 1708 int result = it->second.result; |
1710 pending_callback_map_.erase(it); | 1709 pending_callback_map_.erase(it); |
1711 callback->Run(result); | 1710 callback->Run(result); |
1712 } | 1711 } |
1713 | 1712 |
1714 } // namespace net | 1713 } // namespace net |
OLD | NEW |