[noise] snow with multi-threaded blocking io?

dawuud dawuud at riseup.net
Mon Nov 5 23:53:23 PST 2018


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://moderncrypto.org/mail-archive/noise/attachments/20181106/8a0e2546/attachment.sig>


More information about the Noise mailing list