OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/edk/system/node_controller.h" | 5 #include "mojo/edk/system/node_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1262 DLOG(ERROR) << "Received unexpected AcceptPeer message from " << from_node; | 1262 DLOG(ERROR) << "Received unexpected AcceptPeer message from " << from_node; |
1263 DropPeer(from_node, nullptr); | 1263 DropPeer(from_node, nullptr); |
1264 return; | 1264 return; |
1265 } | 1265 } |
1266 | 1266 |
1267 scoped_refptr<NodeChannel> channel = it->second.first; | 1267 scoped_refptr<NodeChannel> channel = it->second.first; |
1268 ports::PortRef local_port = it->second.second; | 1268 ports::PortRef local_port = it->second.second; |
1269 pending_peers_.erase(it); | 1269 pending_peers_.erase(it); |
1270 DCHECK(channel); | 1270 DCHECK(channel); |
1271 | 1271 |
1272 DVLOG(1) << "Node " << name_ << " accepted peer " << peer_name; | 1272 if (name_ != peer_name) { |
Ken Rockot(use gerrit already)
2016/09/01 23:43:34
nit: I was originally a bit confused about why thi
Sam McNally
2016/09/02 00:13:24
Done.
| |
1273 DVLOG(1) << "Node " << name_ << " accepted peer " << peer_name; | |
1273 | 1274 |
1274 AddPeer(peer_name, channel, false /* start_channel */); | 1275 AddPeer(peer_name, channel, false /* start_channel */); |
1276 } | |
1275 | 1277 |
1276 // We need to choose one side to initiate the port merge. It doesn't matter | 1278 // We need to choose one side to initiate the port merge. It doesn't matter |
1277 // who does it as long as they don't both try. Simple solution: pick the one | 1279 // who does it as long as they don't both try. Simple solution: pick the one |
1278 // with the "smaller" port name. | 1280 // with the "smaller" port name. |
1279 if (local_port.name() < port_name) { | 1281 if (local_port.name() < port_name) { |
1280 node()->MergePorts(local_port, peer_name, port_name); | 1282 node()->MergePorts(local_port, peer_name, port_name); |
1281 } | 1283 } |
1282 } | 1284 } |
1283 | 1285 |
1284 void NodeController::OnChannelError(const ports::NodeName& from_node, | 1286 void NodeController::OnChannelError(const ports::NodeName& from_node, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1349 shutdown_callback_flag_.Set(false); | 1351 shutdown_callback_flag_.Set(false); |
1350 } | 1352 } |
1351 | 1353 |
1352 DCHECK(!callback.is_null()); | 1354 DCHECK(!callback.is_null()); |
1353 | 1355 |
1354 callback.Run(); | 1356 callback.Run(); |
1355 } | 1357 } |
1356 | 1358 |
1357 } // namespace edk | 1359 } // namespace edk |
1358 } // namespace mojo | 1360 } // namespace mojo |
OLD | NEW |