Streamer#57
Conversation
|
this is 10x slower then what is in the loom repo |
|
woot! want to give a quick look on the design? ill merge and squash and add a test for dup/sender |
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
+ Coverage 91.57% 91.85% +0.27%
==========================================
Files 12 14 +2
Lines 724 1031 +307
==========================================
+ Hits 663 947 +284
- Misses 61 84 +23
Continue to review full report at Codecov.
|
|
Anatoly, can you rebase on the latest? |
| fn run_read_from(&mut self, socket: &UdpSocket) -> Result<usize> { | ||
| self.packets.resize(BLOCK_SIZE, Packet::default()); | ||
| let mut i = 0; | ||
| for p in self.packets.iter_mut() { |
There was a problem hiding this comment.
This is really dumb, but, if i used an enumerate, i would still need a mut to return the value outside of the loop. If i had a return instead of a break, then the return statement at the end of the function would be unreachable.
| IO(std::io::Error), | ||
| JSON(serde_json::Error), | ||
| AddrParse(std::net::AddrParseError), | ||
| JoinError(Box<Any + Send + 'static>), |
There was a problem hiding this comment.
That seems odd. What's going on here?
There was a problem hiding this comment.
I am converting the join error type into the result type. It has a really weird signature because its a return value of the closure that is passed into spawn.
There was a problem hiding this comment.
That `static most likely comes from the possibility of the thread outliving the parent thread. You can get that out of there by either using an explicit lifetime or using scoped threads from crossbeam.
There was a problem hiding this comment.
seems like a big change just for the type. for a return value the 'static' isn't a huge problem because all-most all the apis just return ()
|
|
||
| fn addr_parse_error() -> Result<SocketAddr> { | ||
| let r = "12fdfasfsafsadfs".parse()?; | ||
| return Ok(r); |
There was a problem hiding this comment.
These two lines can be reduced to:
"12fdfasfsafsadfs".parse()There was a problem hiding this comment.
it doesn't do the conversion
--> src/result.rs:74:9
|
73 | fn join_error() -> Result<()> {
| ---------- expected `std::result::Result<(), resul
t::Error>` because of return type
74 | thread::spawn(|| panic!("hi")).join()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `result::Erro
r`, found struct `std::boxed::Box`
|
= note: expected type `std::result::Result<(), result::Error>`
found type `std::result::Result<_, std::boxed::Box<std::any::Any
+ std::marker::Send + 'static>>`
fn join_error() -> Result<()> {
thread::spawn(|| panic!("hi")).join()
}
or
fn join_error() -> Result<()> {
Result::from(thread::spawn(|| panic!("hi")).join())
}
doesn't work either
| } | ||
|
|
||
| fn join_error() -> Result<()> { | ||
| thread::spawn(|| panic!("hi")).join()?; |
There was a problem hiding this comment.
Same with this and the next few
| fn read_from(&mut self, socket: &UdpSocket) -> Result<()> { | ||
| let sz = self.run_read_from(socket)?; | ||
| self.packets.resize(sz, Packet::default()); | ||
| return Ok(()); |
There was a problem hiding this comment.
The last line of a function should just be an expression, not a statement. In most of you functions, can you replace return Ok(()); with just Ok(())?
There was a problem hiding this comment.
yar, you cant teach an old c-dog new tricks
| r: Receiver<SharedPacketData>, | ||
| ) -> JoinHandle<()> { | ||
| spawn(move || loop { | ||
| match recv_send(&sock, recycler.clone(), &r) { |
There was a problem hiding this comment.
Looks like this could reduce to:
if recv_send(&sock, recycler.clone(), &r).is_err() && exit.lock().unwrap() {
break;
}|
|
||
| pub type Result<T> = std::result::Result<T, Error>; | ||
|
|
||
| impl std::convert::From<std::sync::mpsc::RecvError> for Error { |
* message needs to fit into 256 bytes * allocator to keep track of blocks of messages * udp socket receiver server that fills up the block as fast as possible * udp socket sender server that sends out the block as fast as possible
|
@garious do you know how to enable ipv6 on travis? |
|
No, I don't know how to enable ipv6, but if it's not easy to do and you want to keep moving forward, guard your new functionality with a feature flag. Are you planning to close this PR in favor of the other? |
|
no, pipelining |
No description provided.