Last active
January 29, 2017 13:04
-
-
Save allengeorge/1a150324297884d563d23381cad2a0e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling thrift v1.0.0 (file:///Users/allen/src/rust_projects/thrift/lib/rs) | |
error[E0277]: the trait bound `protocol::TInputProtocol: std::marker::Send` is not satisfied | |
--> src/server/threaded.rs:161:34 | |
| | |
161 | let handle = thread::spawn(move || handle_incoming_connection(p, i_prot, o_prot)); | |
| ^^^^^^^^^^^^^ the trait `std::marker::Send` is not implemented for `protocol::TInputProtocol` | |
| | |
= note: `protocol::TInputProtocol` cannot be sent between threads safely | |
= note: required because it appears within the type `Box<protocol::TInputProtocol>` | |
= note: required because it appears within the type `[closure@src/server/threaded.rs:161:48: 161:101 p:&mut PR, i_prot:Box<protocol::TInputProtocol>, o_prot:Box<protocol::TOutputProtocol>]` | |
= note: required by `std::thread::spawn` | |
error[E0277]: the trait bound `protocol::TOutputProtocol: std::marker::Send` is not satisfied | |
--> src/server/threaded.rs:161:34 | |
| | |
161 | let handle = thread::spawn(move || handle_incoming_connection(p, i_prot, o_prot)); | |
| ^^^^^^^^^^^^^ the trait `std::marker::Send` is not implemented for `protocol::TOutputProtocol` | |
| | |
= note: `protocol::TOutputProtocol` cannot be sent between threads safely | |
= note: required because it appears within the type `Box<protocol::TOutputProtocol>` | |
= note: required because it appears within the type `[closure@src/server/threaded.rs:161:48: 161:101 p:&mut PR, i_prot:Box<protocol::TInputProtocol>, o_prot:Box<protocol::TOutputProtocol>]` | |
= note: required by `std::thread::spawn` | |
error: aborting due to 2 previous errors | |
error: Could not compile `thrift`. | |
To learn more, run the command again with --verbose. | |
allen@mrwiggles ~/s/r/t/l/rs> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct TBinaryInputProtocol { | |
strict: bool, | |
transport: Rc<RefCell<Box<TTransport>>>, | |
} | |
pub struct TBinaryOutputProtocol { | |
strict: bool, | |
transport: Rc<RefCell<Box<TTransport>>>, | |
} | |
pub struct TCompactInputProtocol { | |
// Identifier of the last field deserialized for a struct. | |
last_read_field_id: i16, | |
// Stack of the last read field ids (a new entry is added each time a nested struct is read). | |
read_field_id_stack: Vec<i16>, | |
// Boolean value for a field. | |
// Saved because boolean fields and their value are encoded in a single byte, | |
// and reading the field only occurs after the field id is read. | |
pending_read_bool_value: Option<bool>, | |
// Underlying transport used for byte-level operations. | |
transport: Rc<RefCell<Box<TTransport>>>, | |
} | |
pub struct TCompactOutputProtocol { | |
// Identifier of the last field serialized for a struct. | |
last_write_field_id: i16, | |
// Stack of the last written field ids (a new entry is added each time a nested struct is written). | |
write_field_id_stack: Vec<i16>, | |
// Field identifier of the boolean field to be written. | |
// Saved because boolean fields and their value are encoded in a single byte | |
pending_write_bool_field_identifier: Option<TFieldIdentifier>, | |
// Underlying transport used for byte-level operations. | |
transport: Rc<RefCell<Box<TTransport>>>, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn listen(&mut self, listen_address: &str) -> ::Result<()> { | |
let listener = TcpListener::bind(listen_address)?; | |
for stream in listener.incoming() { | |
match stream { | |
Ok(s) => { | |
let (i_prot, o_prot) = self.new_protocols_for_connection(s); | |
let p = &mut self.processor; // FIXME: why can't I inline this? | |
let handle = thread::spawn(move || handle_incoming_connection(p, i_prot, o_prot)); | |
}, | |
Err(e) => { | |
warn!("failed to accept remote connection with error {:?}", e); | |
}, | |
} | |
} | |
Err(::Error::Application(ApplicationError { | |
kind: ApplicationErrorKind::Unknown, | |
message: "aborted listen loop".into(), | |
})) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment