cpp-libp2p
cpp-libp2p copied to clipboard
Remove TLS dependency on TCP
- Remove
dynamic_cast. - Can use TLS over any libp2p stream.
- Can use in WASM (browsers don't allow TCP).
Open questions:
-
std::error_codeandboost::system::error_codeconversion.- Inconsistent conversions may create memory leaks (e.g.
s1 -> b1, b1 -> s1', s1' -> b1', ...).-
Boost makes std::error_category wrapper for boost::system::error_category. It proxies
name()andmessage()calls. But we can't inject original std::error_category into this mapping. So even if we maintain our own mapping, but some code casts error via boost, it may create new wrappers indefinitely.
-
Boost makes std::error_category wrapper for boost::system::error_category. It proxies
- Error comparison may be unavailable (e.g.
error == EOF) for underlying stream errors.- If we will map to single boost error.
- Or if conversion is inconsistent (e.g.
s1 -> b1, b1 -> s1', s1 != s1').
- May store last read and write errors in stream instance (like errno), as there can only be one active read/write.
- Inconsistent conversions may create memory leaks (e.g.
- May need to check lifetimes during async read/write operation.