Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: remoting/protocol/ice_transport.cc

Issue 1662673002: Add MessageChanneFactory interface and use it in ChannelDispatcherBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@framing
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/ice_transport.h ('k') | remoting/protocol/ice_transport_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/ice_transport.cc
diff --git a/remoting/protocol/ice_transport.cc b/remoting/protocol/ice_transport.cc
index 858500e574a318db6e9e9b0ff097e89ce865da5b..4d243b4dfc653bde0d6415571d1cfb584d352d4f 100644
--- a/remoting/protocol/ice_transport.cc
+++ b/remoting/protocol/ice_transport.cc
@@ -10,6 +10,7 @@
#include "remoting/protocol/pseudotcp_channel_factory.h"
#include "remoting/protocol/secure_channel_factory.h"
#include "remoting/protocol/stream_channel_factory.h"
+#include "remoting/protocol/stream_message_pipe_adapter.h"
#include "remoting/protocol/transport_context.h"
namespace remoting {
@@ -45,6 +46,9 @@ void IceTransport::Start(
pseudotcp_channel_factory_.reset(new PseudoTcpChannelFactory(this));
secure_channel_factory_.reset(new SecureChannelFactory(
pseudotcp_channel_factory_.get(), authenticator));
+ message_channel_factory_.reset(new StreamMessageChannelFactoryAdapter(
+ secure_channel_factory_.get(),
+ base::Bind(&IceTransport::OnChannelError, weak_factory_.GetWeakPtr())));
}
bool IceTransport::ProcessTransportInfo(buzz::XmlElement* transport_info_xml) {
@@ -79,16 +83,19 @@ bool IceTransport::ProcessTransportInfo(buzz::XmlElement* transport_info_xml) {
return true;
}
-StreamChannelFactory* IceTransport::GetStreamChannelFactory() {
- return secure_channel_factory_.get();
+MessageChannelFactory* IceTransport::GetChannelFactory() {
+ return message_channel_factory_.get();
}
-StreamChannelFactory* IceTransport::GetMultiplexedChannelFactory() {
- if (!channel_multiplexer_.get()) {
+MessageChannelFactory* IceTransport::GetMultiplexedChannelFactory() {
+ if (!channel_multiplexer_) {
channel_multiplexer_.reset(
- new ChannelMultiplexer(GetStreamChannelFactory(), kMuxChannelName));
+ new ChannelMultiplexer(secure_channel_factory_.get(), kMuxChannelName));
+ mux_channel_factory_.reset(new StreamMessageChannelFactoryAdapter(
+ channel_multiplexer_.get(),
+ base::Bind(&IceTransport::OnChannelError, weak_factory_.GetWeakPtr())));
}
- return channel_multiplexer_.get();
+ return mux_channel_factory_.get();
}
void IceTransport::CreateChannel(const std::string& name,
@@ -191,5 +198,10 @@ void IceTransport::SendTransportInfo() {
send_transport_info_callback_.Run(std::move(transport_info_xml));
}
+void IceTransport::OnChannelError(int error) {
+ LOG(ERROR) << "Data channel failed, error=" << error;
+ event_handler_->OnIceTransportError(CHANNEL_CONNECTION_ERROR);
+}
+
} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/ice_transport.h ('k') | remoting/protocol/ice_transport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698