Index: remoting/protocol/webrtc_connection_to_client.cc |
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc |
index a625300f5e8e9965865fe0d30aa7e49e31618c3a..d045e623d2c127682b3681b44d54fbff941d8bd0 100644 |
--- a/remoting/protocol/webrtc_connection_to_client.cc |
+++ b/remoting/protocol/webrtc_connection_to_client.cc |
@@ -18,6 +18,7 @@ |
#include "remoting/protocol/host_event_dispatcher.h" |
#include "remoting/protocol/host_stub.h" |
#include "remoting/protocol/input_stub.h" |
+#include "remoting/protocol/message_pipe.h" |
#include "remoting/protocol/transport_context.h" |
#include "remoting/protocol/webrtc_transport.h" |
#include "remoting/protocol/webrtc_video_stream.h" |
@@ -155,10 +156,6 @@ void WebrtcConnectionToClient::OnSessionStateChange(Session::State state) { |
void WebrtcConnectionToClient::OnWebrtcTransportConnecting() { |
control_dispatcher_->Init(transport_->outgoing_channel_factory(), this); |
Jamie
2016/07/19 18:24:47
Could this be initialized in OnWebrtcTransportInco
Sergey Ulanov
2016/07/19 23:38:43
Control channel is created by the host, while even
Jamie
2016/07/20 00:31:39
It's beyond the scope of this CL, but would it be
Sergey Ulanov
2016/07/20 01:18:22
I think we want to support creation of channels in
|
- |
- event_dispatcher_->Init(transport_->incoming_channel_factory(), this); |
- event_dispatcher_->set_on_input_event_callback(base::Bind( |
- &ConnectionToClient::OnInputEventReceived, base::Unretained(this))); |
} |
void WebrtcConnectionToClient::OnWebrtcTransportConnected() { |
@@ -170,6 +167,17 @@ void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) { |
Disconnect(error); |
} |
+void WebrtcConnectionToClient::OnWebrtcTransportIncomingDataChannel( |
+ const std::string& name, |
+ std::unique_ptr<MessagePipe> pipe) { |
+ if (name == event_dispatcher_->channel_name() && |
+ !event_dispatcher_->is_connected()) { |
+ event_dispatcher_->set_on_input_event_callback(base::Bind( |
+ &ConnectionToClient::OnInputEventReceived, base::Unretained(this))); |
+ event_dispatcher_->Init(std::move(pipe), this); |
+ } |
+} |
+ |
void WebrtcConnectionToClient::OnWebrtcTransportMediaStreamAdded( |
scoped_refptr<webrtc::MediaStreamInterface> stream) { |
LOG(WARNING) << "The client created an unexpected media stream."; |
@@ -188,5 +196,14 @@ void WebrtcConnectionToClient::OnChannelInitialized( |
} |
} |
+void WebrtcConnectionToClient::OnChannelClosed( |
+ ChannelDispatcherBase* channel_dispatcher) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ |
+ LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() |
+ << " was closed unexpectedly."; |
+ Disconnect(INCOMPATIBLE_PROTOCOL); |
+} |
+ |
} // namespace protocol |
} // namespace remoting |