Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
| 6 | 6 |
| 7 #include <algorithm> // min | 7 #include <algorithm> // min |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 write_buffer_len_ = 0; | 489 write_buffer_len_ = 0; |
| 490 | 490 |
| 491 // Proxy write callbacks result in deep callback chains. Post to allow the | 491 // Proxy write callbacks result in deep callback chains. Post to allow the |
| 492 // stream's write callback chain to unwind (see crbug.com/355511). | 492 // stream's write callback chain to unwind (see crbug.com/355511). |
| 493 base::ThreadTaskRunnerHandle::Get()->PostTask( | 493 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 494 FROM_HERE, base::Bind(&SpdyProxyClientSocket::RunCallback, | 494 FROM_HERE, base::Bind(&SpdyProxyClientSocket::RunCallback, |
| 495 write_callback_weak_factory_.GetWeakPtr(), | 495 write_callback_weak_factory_.GetWeakPtr(), |
| 496 ResetAndReturn(&write_callback_), rv)); | 496 ResetAndReturn(&write_callback_), rv)); |
| 497 } | 497 } |
| 498 | 498 |
| 499 void SpdyProxyClientSocket::OnTrailers(const SpdyHeaderBlock& trailers) {} | |
|
Ryan Hamilton
2015/08/10 22:37:38
Ignoring headers is fine, though you could also cl
xunjieli
2015/08/11 15:07:14
I added a comment. I am not sure how to close the
Ryan Hamilton
2015/08/11 16:30:09
Hm. Good question :> Perhaps leaving it alone is f
xunjieli
2015/08/11 17:58:11
Done. You are right -- the proxy client socket's S
| |
| 500 | |
| 499 void SpdyProxyClientSocket::OnClose(int status) { | 501 void SpdyProxyClientSocket::OnClose(int status) { |
| 500 was_ever_used_ = spdy_stream_->WasEverUsed(); | 502 was_ever_used_ = spdy_stream_->WasEverUsed(); |
| 501 spdy_stream_.reset(); | 503 spdy_stream_.reset(); |
| 502 | 504 |
| 503 bool connecting = next_state_ != STATE_DISCONNECTED && | 505 bool connecting = next_state_ != STATE_DISCONNECTED && |
| 504 next_state_ < STATE_OPEN; | 506 next_state_ < STATE_OPEN; |
| 505 if (next_state_ == STATE_OPEN) | 507 if (next_state_ == STATE_OPEN) |
| 506 next_state_ = STATE_CLOSED; | 508 next_state_ = STATE_CLOSED; |
| 507 else | 509 else |
| 508 next_state_ = STATE_DISCONNECTED; | 510 next_state_ = STATE_DISCONNECTED; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 522 } else if (!read_callback_.is_null()) { | 524 } else if (!read_callback_.is_null()) { |
| 523 // If we have a read_callback_, the we need to make sure we call it back. | 525 // If we have a read_callback_, the we need to make sure we call it back. |
| 524 OnDataReceived(scoped_ptr<SpdyBuffer>()); | 526 OnDataReceived(scoped_ptr<SpdyBuffer>()); |
| 525 } | 527 } |
| 526 // This may have been deleted by read_callback_, so check first. | 528 // This may have been deleted by read_callback_, so check first. |
| 527 if (weak_ptr.get() && !write_callback.is_null()) | 529 if (weak_ptr.get() && !write_callback.is_null()) |
| 528 write_callback.Run(ERR_CONNECTION_CLOSED); | 530 write_callback.Run(ERR_CONNECTION_CLOSED); |
| 529 } | 531 } |
| 530 | 532 |
| 531 } // namespace net | 533 } // namespace net |
| OLD | NEW |