[noise] snow with multi-threaded blocking io?

Jake McGinty me at jake.su
Tue Nov 6 02:13:41 PST 2018


Hey David,

Glad it worked out. Feel free to suggest ideas at https://github.com/mcginty/snow/issues/15 (and also feel free check out the experiments I did for wireguard-rs on the "wireguard" branch). There are a few possible improvements to make snow more performant in these situations but no specific plans to implement them in master yet.

I'm going to guess, though, that this mailing list isn't the ideal avenue for talking about issues with specific implementations since it's unrelated to the protocol itself. There's not a lot of activity on the repo recently but I still check the issues on github if you have any more questions about snow :).

~ jake

On Tue, Nov 6, 2018, at 3:53 PM, dawuud wrote:
> 
> I got it working by using an Arc Mutex around my wrapper type which 
> encapsulated the snow::Session.
> Works fine. No tokio involved. I like this solution for my mix server.
> 
> Cheers,
> David
> 
> 
> On Mon, Nov 05, 2018 at 10:56:25PM +0000, dawuud wrote:
> > 
> > Hi,
> > 
> > 
> > Is anyone else using the rust noise library, ``snow`` with multiple blocking threads?
> > crates.io lists two other projects as depending on snow:
> > 
> > * https://crates.io/crates/exonum
> > * https://crates.io/crates/carrier
> > 
> > These are both using tokio.
> > 
> > 
> > Why am I not using tokio?
> > 
> > I am writing a computationally intensive application which is rediculously parallelizable
> > and therefore async io is not the answer. So I wrote this snow-based API that uses blocking io
> > on tcp streams:
> > 
> > https://github.com/david415/mix_link/blob/e19958ad3efc14fc79748ce98e20cf1b5ccee012/src/sync.rs#L34
> > 
> > There are no synchronization primitives being used. But then I
> > realized: Arc<Mutex<session>> is terrible because it limits the
> > protocol to strict query and then response like http. Whereas I want it to be
> > an unsequenced bidirectional protocol.
> > 
> > What is the best way to accomplish this?
> > 
> > 
> > It seems I have two choices:
> > 
> > a. use tokio at the beginning of the pipeline to handle the noise session io and crypto
> > b. do something weird that nobody else is doing. perhaps use an Arc<Mutex< around snow::Session or so?
> > 
> > 
> > Isn't it the case that unless snow provides some additional features, only
> > one thread can use the snow::Session at a time?
> > 
> > 
> > Thoughts?
> > 
> > Cheers,
> > David
> 
> 
> 
> > _______________________________________________
> > Noise mailing list
> > Noise at moderncrypto.org
> > https://moderncrypto.org/mailman/listinfo/noise
> 
> _______________________________________________
> Noise mailing list
> Noise at moderncrypto.org
> https://moderncrypto.org/mailman/listinfo/noise
> Email had 1 attachment:
> + signature.asc
>   1k (application/pgp-signature)


More information about the Noise mailing list