Open Sjors opened 2 months ago
@pinheadmz wrote in the original PR:
I am working on a libevent-replacing HTTP server using netbase primitives and yeah, I have some functions that look a lot like the sv2connamn in this branch.
I think it would be cool if possible to abstract the mechanisms in
ThreadSocketHandler
to work on "abstract clients" and I'd be happy to review and collaborate on that.
I plan to take a look at this.
CMake rebase.
Rebased to move everything into a bitcoin_sv2
library (use -DWITH_SV2=ON
to compile).
I turned Sv2Connman
into a subclass of SockMan
using https://github.com/bitcoin/bitcoin/pull/30988. This gets rid of most of the copy-paste stuff.
Two open questions:
m_disconnect_flag
still make sense, given that I call CloseConnection
everywhere?EventReadyToSend
use the more
flag?MSAN is unhappy:
[15:40:15.757] Uninitialized value was created by an allocation of 'storage' in the stack frame
[15:40:15.757] #0 0x55dc46e92b31 in SockMan::AcceptConnection(Sock const&, CService&) ci/scratch/build-x86_64-pc-linux-gnu/src/./src/common/sockman.cpp:351:5
[15:40:15.757]
[15:40:15.757] SUMMARY: MemorySanitizer: use-of-uninitialized-value ci/scratch/build-x86_64-pc-linux-gnu/src/./src/netaddress.cpp:812:5 in CService::SetSockAddr(sockaddr const*)
Maybe a4d82935024762b3c9500c2dafc8986a5d62836a makes it happy?
MSAN is happy. The last push just adds the dependency on bitcoin_common
, which on macOS isn't needed, but the Linux Guix build is more picky.
Based on https://github.com/bitcoin/bitcoin/pull/30315, https://github.com/bitcoin/bitcoin/pull/30205 and https://github.com/bitcoin/bitcoin/pull/30988. Followed by #49.
Parent PR https://github.com/bitcoin/bitcoin/pull/29432.
This PR introduces
Sv2Connman
, a subclass ofSockMan
(https://github.com/bitcoin/bitcoin/pull/30988). It uses theSv2Transport
introduced in https://github.com/bitcoin/bitcoin/pull/30315 to enable incoming connections from other Stratum v2 roles.It's main target user is the Template Provider role introduced in #49.
There may be other Stratum v2 roles we want to support in the future.
Note to self, to keep this rebased until https://github.com/bitcoin/bitcoin/pull/30988 lands:
Earlier version(s): https://github.com/bitcoin/bitcoin/pull/30332