MCPcopy Create free account
hub / github.com/davisking/dlib / send_out_connection_orders

Function send_out_connection_orders

dlib/bsp/bsp.cpp:64–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62
63
64 void send_out_connection_orders (
65 map_id_to_con& cons,
66 const std::vector<network_address>& hosts
67 )
68 {
69 // tell everyone their node ids
70 cons.reset();
71 while (cons.move_next())
72 {
73 dlib::serialize(cons.element().key(), cons.element().value()->stream);
74 }
75
76 // now tell them who to connect to
77 std::vector<hostinfo> targets;
78 for (unsigned long i = 0; i < hosts.size(); ++i)
79 {
80 hostinfo info(hosts[i], i+1);
81
82 dlib::serialize(targets, cons[info.node_id]->stream);
83 targets.push_back(info);
84
85 // let the other host know how many incoming connections to expect
86 const unsigned long num = hosts.size()-targets.size();
87 dlib::serialize(num, cons[info.node_id]->stream);
88 cons[info.node_id]->stream.flush();
89 }
90 }
91
92 // ------------------------------------------------------------------------------------
93

Callers 1

bsp_connectFunction · 0.85

Calls 7

serializeFunction · 0.70
resetMethod · 0.45
move_nextMethod · 0.45
valueMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected