citadel-tech / coinswap

Functioning, minimal-viable binaries and libraries to perform a trustless, p2p Maxwell-Belcher Coinswap Protocol
https://gist.github.com/chris-belcher/9144bd57a91c194e332fb5ca371d0964
Other
68 stars 43 forks source link

[improve] Make Send and Recv message calls blocking. #185

Closed mojoX911 closed 1 week ago

mojoX911 commented 2 months ago

A major source of cascading async functions in the library is the send and recv calls. Which were made async for historical reason, but they don't need to be async.

https://github.com/citadel-tech/coinswap/blob/a85c9a33cc56619a6c55d35ede2cab0c7f36aa81/src/utill.rs#L175-L195

Turning these two function into regular blocking functions will simplify the runtimes as well as will make many other higher level functions non-async too.

Similarly the read_rpc_message function can be blocking too.

https://github.com/citadel-tech/coinswap/blob/a85c9a33cc56619a6c55d35ede2cab0c7f36aa81/src/maker/rpc/server.rs#L15-L35

This will probably allow us to make the start_rpc_server method blocking and we can spawn a blocking thread to handle it.

Rohanarora17 commented 2 months ago

can I work on this?

mojoX911 commented 2 months ago

Yes, please. Would love to see an initial attempt, even if not a final version.