| 33 | } |
| 34 | |
| 35 | void connect_all_hostinfo ( |
| 36 | map_id_to_con& cons, |
| 37 | const std::vector<hostinfo>& hosts, |
| 38 | unsigned long node_id, |
| 39 | std::string& error_string |
| 40 | ) |
| 41 | { |
| 42 | cons.clear(); |
| 43 | for (unsigned long i = 0; i < hosts.size(); ++i) |
| 44 | { |
| 45 | try |
| 46 | { |
| 47 | std::unique_ptr<bsp_con> con(new bsp_con(hosts[i].addr)); |
| 48 | dlib::serialize(node_id, con->stream); // tell the other end our node_id |
| 49 | con->stream.flush(); |
| 50 | unsigned long id = hosts[i].node_id; |
| 51 | cons.add(id, con); |
| 52 | } |
| 53 | catch (std::exception&) |
| 54 | { |
| 55 | std::ostringstream sout; |
| 56 | sout << "Could not connect to " << hosts[i].addr; |
| 57 | error_string = sout.str(); |
| 58 | break; |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | |
| 64 | void send_out_connection_orders ( |