We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code results in:
Compiling chat v0.1.0 (file:///home/chris/rust/chat) task 'rustc' has overflowed its stack Could not compile `chat`.
use std::io::{TcpListener, TcpStream}; use std::io::{Acceptor, Listener}; enum StreamOrSlice { Strm(TcpStream), Slc(uint, [u8, ..1024]) } fn main() { let listener = TcpListener::bind("127.0.0.1", 5555); // bind the listener to the specified address let mut acceptor = listener.listen(); let (tx, rx) = channel(); spawn(proc() { let mut streams: Vec<TcpStream> = Vec::new(); loop { let rxd: StreamOrSlice = rx.recv(); match rxd { Strm(stream) => { streams.push(stream); } Slc(len, buf) => { for stream in streams.iter_mut() { let _ = stream.write(buf.slice(0, len)); } } } } }); // accept connections and process them, spawning a new tasks for each one for stream in acceptor.incoming() { match stream { Err(e) => { /* connection failed */ } Ok(mut stream) => { // connection succeeded tx.send(Strm(stream.clone())); let tx2 = tx.clone(); spawn(proc() { let mut buf: [u8, ..1024] = [0, ..1024]; loop { let len = stream.read(buf); tx2.send(Slc(len.unwrap(), buf)); } }) } } } }
P.S.
chris@grey:~$ rustc --version rustc 0.12.0-nightly (a70a0374e 2014-10-01 21:27:19 +0000)
The text was updated successfully, but these errors were encountered:
The actual problem being exposed here is the match on [u8, ..1024] which I reported as #17877.
Sorry, something went wrong.
No branches or pull requests
The following code results in:
P.S.
The text was updated successfully, but these errors were encountered: