forked from M-Labs/artiq-zynq
comms: replace TcpStream::listen() with TcpStream::accept()
This commit is contained in:
parent
b6c0f0baed
commit
5af2acc760
@ -18,7 +18,7 @@ use libboard_zynq::{
|
|||||||
};
|
};
|
||||||
use libsupport_zynq::alloc::{vec, vec::Vec};
|
use libsupport_zynq::alloc::{vec, vec::Vec};
|
||||||
use libcortex_a9::sync_channel;
|
use libcortex_a9::sync_channel;
|
||||||
use libasync::smoltcp::{Sockets, TcpStream};
|
use libasync::{smoltcp::{Sockets, TcpStream}, task};
|
||||||
|
|
||||||
use crate::kernel;
|
use crate::kernel;
|
||||||
|
|
||||||
@ -209,10 +209,16 @@ pub fn main(mut sc_tx: sync_channel::Sender<usize>, mut sc_rx: sync_channel::Rec
|
|||||||
|
|
||||||
Sockets::init(32);
|
Sockets::init(32);
|
||||||
|
|
||||||
TcpStream::listen(1381, 2048, 2048, 8, |stream| async {
|
task::spawn(async {
|
||||||
let _ = handle_connection(stream)
|
loop {
|
||||||
.await
|
while let stream = TcpStream::accept(1381, 2048, 2048).await.unwrap() {
|
||||||
.map_err(|e| println!("Connection: {}", e));
|
task::spawn(async {
|
||||||
|
let _ = handle_connection(stream)
|
||||||
|
.await
|
||||||
|
.map_err(|e| println!("Connection: {}", e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut time = 0u32;
|
let mut time = 0u32;
|
||||||
|
Loading…
Reference in New Issue
Block a user