Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 07 2018 13:58
    @tobz banned @SoniEx2
  • Aug 01 2018 23:32

    carllerche on gh-pages

    Documentation for tokio-rs/toki… (compare)

  • Aug 01 2018 23:29

    carllerche on master

    Deprecate tokio-proto. (#209) (compare)

  • Aug 01 2018 23:29
    carllerche closed #209
  • Aug 01 2018 19:10
    tobz commented #207
  • Aug 01 2018 19:08
    tobz synchronize #209
  • Aug 01 2018 19:00
    tobz commented #209
  • Aug 01 2018 19:00
    tobz opened #209
  • Jul 26 2018 14:13
    upsuper opened #208
  • Jul 20 2018 03:16
    driftluo edited #207
  • Jul 20 2018 03:15
    driftluo opened #207
  • Jun 15 2018 13:04
    ignatenkobrain opened #206
  • Jun 12 2018 01:41
    rphmeier commented #205
  • Jun 12 2018 01:41
    rphmeier edited #205
  • Jun 12 2018 01:40
    rphmeier commented #205
  • Jun 12 2018 01:40
    rphmeier closed #205
  • Jun 12 2018 01:40
    rphmeier commented #205
  • Jun 12 2018 01:40
    rphmeier commented #205
  • Jun 12 2018 01:36
    rphmeier opened #205
  • Jun 01 2018 13:55
    flosse commented #202
osa1 @osa1 tries rustup
Ömer Sinan Ağacan
@osa1
alright, that fixed it
Ömer Sinan Ağacan
@osa1
what is a good way to select between multiple Futures in nightly + tokio-0.2.0-alpha.2 ?
Ömer Sinan Ağacan
@osa1
how do I get a FusedFuture from a tokio::io::Stdin?
James Sewell
@jamessewell
you can call .fuse() to fuse Futures
Or Streams
Ömer Sinan Ağacan
@osa1
that doesn't work on Stdin
ah, sorry
you're right
I need read().fuse()
James Sewell
@jamessewell
I really can't see any way to make stream::poll_fn work while still allowing the inner stream to be borrowed mutably?
Ömer Sinan Ağacan
@osa1
anyone have any idea why I might be getting this error when reading stdin in a task: "blockingannotated I/O must be called from the context of the Tokio runtime." ?
Carl Lerche
@carllerche
@osa1 assuming 0.2.0-alpha, and you are calling it from the main function, it is a known bug... right now tokio-fs can only be called in spawned futures
i'm working on fixing it
Lucio Franco
@LucioFranco
@jamessewell you most likely want to implement FusedStream for DelayQueue so that you can also call reset on it, I think that is your issue
if its a FusedStream it doesn't need to have .fuse() called on it
James Sewell
@jamessewell
@LucioFranco yeah I’ve done that (is_terminated is hard coded to false) - that lets me insert while driving the DelayQueue from a select! It’s the driving part I can’t get. .next() always returns if the queue is non-empty and I can’t call poll_next without a Context. @carllerche suggested poll_fn to wrap and map with a context, but the the poll_fn closure stops me mutably borrowing the DelayQueue to add and remove from it
Toby Lawrence
@tobz
what does it return?
i mean, every future eventually returns
or stream
James Sewell
@jamessewell
The select branch it’s in constantly fires, cpu hits 100%
Even before any delays expire
Just getting None
Lucio Franco
@LucioFranco
are you using select_next_some
James Sewell
@jamessewell
Ooh. No.
Lucio Franco
@LucioFranco
that might help?
James Sewell
@jamessewell
Sounds like it’s exactly what I want
So should an empty DelayQueue return true from is_terminated? I would have thought no, that suggests yes
(This is for the impl)
Lucio Franco
@LucioFranco
good question not sure
Toby Lawrence
@tobz
oh hmmm
I guess this is a cornercase of how those mutable streams function
well, not corner case per se, but yeah, any stream that can return None but then have items in the future
looks like they added that method specifically for this case :P
James Sewell
@jamessewell
Yeah that works like a charm
            m = stream.select_next_some() =>{
                match m {
                    Ok(proto::SmppMessage::BindTransmitterResp { inner }) => {
                        for _ in 0 as usize..1 {
                            let sequence = sequence_counter.fetch_add(1, Ordering::SeqCst);
                            sink
                                .send(proto::SubmitSm::new(...)).await?;
                            response_waiting.insert(sequence,response_waiting_queue.insert(sequence, Duration::from_secs(5)));
                        }
                    }
Is having serial .await calls in a select! like this bad?
This works perfectly, if I up it to ..10 I get dropped packets
(dropped as in I can see them exit the service I connect to, arrive on my node, but they never get processed by Tokio in my loop)
James Sewell
@jamessewell
It seems like it can't be my protocol parsing if it's effected by sending more messages at once
Falco Hirschenberger
@hirschenberger
@carllerche Is there a workaround for the "blocking" annotated I/O must be called from the context of the Tokio runtime. bug? When I try to run my tokio::fs functions in a spawned thread, it doesn't compile because AsyncRead is not Send.
Carl Lerche
@carllerche
Use it from a spawned task in the rt
Bug fix should bug fix should be coming soonish
Toby Lawrence
@tobz
huh, TIL: if you derive clone on a type that isn't actually cloneable by the drive rules, it will silently do so
i.e. if you have a generic type parameter, it indiscriminately applies a Clone bound to it, which, sure, that's fine
but if you don't actually satisfy that, the best you get is that your type, as a whole, doesn't impl Clone
which makes sense but is a frustrating debug experience
Douman
@DoumanAsh
It will throw error if it is not.
It is not throwing error only with generics where it generated conditional Clone