Closed baliuzeger closed 5 years ago
`{
code below code below code below
// here
fn run(&mut self, rx_confirm: CCReceiver, tx_report: CCSender) { let mut running_connections = Vec::new(); for conn in &self.out_connections_1 { let running_conn = conn.connection.upgrade().unwrap(); let (tx_conn_report, rx_conn_report) = crossbeam_channel::bounded(1); let (tx_conn_confirm, rx_conn_confirm) = crossbeam_channel::bounded(1); running_connections.push(RunningSet { instance: thread::spawn(move || {running_conn.lock().unwrap() .run_under_agent(rx_conn_confirm, tx_conn_report)}), report: rx_conn_report, confirm: tx_conn_confirm, }); } // failed to use a function of init_connections for conn in &self.out_connections_2 { let running_conn = conn.connection.upgrade().unwrap(); let (tx_conn_report, rx_conn_report) = crossbeam_channel::bounded(1); let (tx_conn_confirm, rx_conn_confirm) = crossbeam_channel::bounded(1); running_connections.push(RunningSet { instance: thread::spawn(move || {running_conn.lock().unwrap() .run_under_agent(rx_conn_confirm, tx_conn_report)}), report: rx_conn_report, confirm: tx_conn_confirm, }); }`
done on branch multi-runtime-mode
`{
code below code below code below
// here
fn run(&mut self, rx_confirm: CCReceiver, tx_report: CCSender) {
let mut running_connections = Vec::new();
for conn in &self.out_connections_1 {
let running_conn = conn.connection.upgrade().unwrap();
let (tx_conn_report, rx_conn_report) = crossbeam_channel::bounded(1);
let (tx_conn_confirm, rx_conn_confirm) = crossbeam_channel::bounded(1);
running_connections.push(RunningSet {
instance: thread::spawn(move || {running_conn.lock().unwrap()
.run_under_agent(rx_conn_confirm, tx_conn_report)}),
report: rx_conn_report,
confirm: tx_conn_confirm,
});
}
// failed to use a function of init_connections
for conn in &self.out_connections_2 { let running_conn = conn.connection.upgrade().unwrap(); let (tx_conn_report, rx_conn_report) = crossbeam_channel::bounded(1); let (tx_conn_confirm, rx_conn_confirm) = crossbeam_channel::bounded(1); running_connections.push(RunningSet { instance: thread::spawn(move || {running_conn.lock().unwrap() .run_under_agent(rx_conn_confirm, tx_conn_report)}), report: rx_conn_report, confirm: tx_conn_confirm, }); }`