| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "remoting/protocol/quic_channel_factory.h" | 5 #include "remoting/protocol/quic_channel_factory.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/quic/crypto/crypto_framer.h" | 16 #include "net/quic/crypto/crypto_framer.h" |
| 17 #include "net/quic/crypto/crypto_handshake_message.h" | 17 #include "net/quic/crypto/crypto_handshake_message.h" |
| 18 #include "net/quic/crypto/crypto_protocol.h" | 18 #include "net/quic/crypto/crypto_protocol.h" |
| 19 #include "net/quic/crypto/quic_random.h" | 19 #include "net/quic/crypto/quic_random.h" |
| 20 #include "net/quic/p2p/quic_p2p_crypto_config.h" | 20 #include "net/quic/p2p/quic_p2p_crypto_config.h" |
| 21 #include "net/quic/p2p/quic_p2p_session.h" | 21 #include "net/quic/p2p/quic_p2p_session.h" |
| 22 #include "net/quic/p2p/quic_p2p_stream.h" | 22 #include "net/quic/p2p/quic_p2p_stream.h" |
| 23 #include "net/quic/quic_clock.h" | 23 #include "net/quic/quic_clock.h" |
| 24 #include "net/quic/quic_connection_helper.h" | 24 #include "net/quic/quic_connection_helper.h" |
| 25 #include "net/quic/quic_default_packet_writer.h" | 25 #include "net/quic/quic_default_packet_writer.h" |
| 26 #include "net/quic/quic_protocol.h" |
| 26 #include "net/socket/stream_socket.h" | 27 #include "net/socket/stream_socket.h" |
| 27 #include "remoting/base/constants.h" | 28 #include "remoting/base/constants.h" |
| 28 #include "remoting/protocol/datagram_channel_factory.h" | 29 #include "remoting/protocol/datagram_channel_factory.h" |
| 29 #include "remoting/protocol/p2p_datagram_socket.h" | 30 #include "remoting/protocol/p2p_datagram_socket.h" |
| 30 #include "remoting/protocol/quic_channel.h" | 31 #include "remoting/protocol/quic_channel.h" |
| 31 | 32 |
| 32 namespace remoting { | 33 namespace remoting { |
| 33 namespace protocol { | 34 namespace protocol { |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 return net::WriteResult(status, result); | 72 return net::WriteResult(status, result); |
| 72 } | 73 } |
| 73 bool IsWriteBlockedDataBuffered() const override { | 74 bool IsWriteBlockedDataBuffered() const override { |
| 74 // P2PDatagramSocket::Send() method buffer the data until the Send is | 75 // P2PDatagramSocket::Send() method buffer the data until the Send is |
| 75 // unblocked. | 76 // unblocked. |
| 76 return true; | 77 return true; |
| 77 } | 78 } |
| 78 bool IsWriteBlocked() const override { return write_blocked_; } | 79 bool IsWriteBlocked() const override { return write_blocked_; } |
| 79 void SetWritable() override { write_blocked_ = false; } | 80 void SetWritable() override { write_blocked_ = false; } |
| 81 net::QuicByteCount GetMaxPacketSize(const net::IPEndPoint& peer_address) const |
| 82 override { |
| 83 return net::kMaxPacketSize; |
| 84 } |
| 80 | 85 |
| 81 private: | 86 private: |
| 82 void OnSendComplete(int result){ | 87 void OnSendComplete(int result){ |
| 83 DCHECK_NE(result, net::ERR_IO_PENDING); | 88 DCHECK_NE(result, net::ERR_IO_PENDING); |
| 84 write_blocked_ = false; | 89 write_blocked_ = false; |
| 85 if (result < 0) { | 90 if (result < 0) { |
| 86 connection_->OnWriteError(result); | 91 connection_->OnWriteError(result); |
| 87 } | 92 } |
| 88 connection_->OnCanWrite(); | 93 connection_->OnCanWrite(); |
| 89 } | 94 } |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 void QuicChannelFactory::CancelChannelCreation(const std::string& name) { | 532 void QuicChannelFactory::CancelChannelCreation(const std::string& name) { |
| 528 core_->CancelChannelCreation(name); | 533 core_->CancelChannelCreation(name); |
| 529 } | 534 } |
| 530 | 535 |
| 531 net::QuicP2PSession* QuicChannelFactory::GetP2PSessionForTests() { | 536 net::QuicP2PSession* QuicChannelFactory::GetP2PSessionForTests() { |
| 532 return core_->quic_session_.get(); | 537 return core_->quic_session_.get(); |
| 533 } | 538 } |
| 534 | 539 |
| 535 } // namespace protocol | 540 } // namespace protocol |
| 536 } // namespace remoting | 541 } // namespace remoting |
| OLD | NEW |