[noise] snow with multi-threaded blocking io?

dawuud dawuud at riseup.net
Mon Nov 5 14:56:25 PST 2018


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
-------------- 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/20181105/d99ca55e/attachment.sig>


More information about the Noise mailing list