Skip to content

Conversation

@Sjors
Copy link
Owner

@Sjors Sjors commented Sep 27, 2024

No description provided.

@vasild
Copy link

vasild commented Oct 4, 2024

Yo! There are two problems here:

  1. In Sv2Connman::EventReadyToSend() it forgot to erase the sent message from the queue, so it kept sending the same message over and over again. Fixed by adding client->m_send_messages.erase(). This fixes the failure of BOOST_REQUIRE_EQUAL(tester.LocalToRemoteBytes(), SV2_HEADER_ENCRYPTED_SIZE + 6 + Poly1305::TAGLEN);
  2. After this, at the exit it didn't properly interrupt SockMan. Fixed by adding interruptNet() in Sv2Connman::Interrupt().

Here is a patch: sv2sockman.diff.txt

The changes to sv2_connman_tests.cpp are not needed for the test to pass but I made them to unconfuse myself from the send vs recv interaction - since both ends of the connection are inside one program, I was confused what does it mean to "send" bytes. So I renamed a bunch of symbols to use the notation of "local" and "remote" and "local to remote" and "remote to local". Another possibility would be to use "us" and "them", e.g. "from us to them" and "from them to us". Feel free to ignore those.

@Sjors
Copy link
Owner Author

Sjors commented Oct 4, 2024

Thanks. I'll apply your changes as well as the test clarifications.

@Sjors Sjors force-pushed the 2024/06/sv2_connection branch from 53f852b to d0ae2f6 Compare October 4, 2024 13:28
@Sjors
Copy link
Owner Author

Sjors commented Oct 4, 2024

Folded all of it into #50! Left a few followup questions there.

Additionally I fixed a few locking warnings and implemented EventGotEOF and EventGotPermanentReadError to just disconnect.

@Sjors Sjors closed this Oct 4, 2024
@Sjors Sjors deleted the 2024/09/sv2_sockman branch October 4, 2024 13:30
Comment on lines 227 to 229
* @param[in] buf Destination to write bytes to.
* @param[in] len Write up to this number of bytes.
* @param[in] flags Same as the flags of `recv(2)`. Just `MSG_PEEK` is honored.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vasild these first two params are in/out right?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to comment on bitcoin#30988? This branch is stale (though not sure if this method changed since).

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#50 uses SockMan and I try to keep it freshly rebased.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok ill start tracking there, just had a few quesitons for @vasild as I'm consuming DynSock in my branch now too

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vasild these first two params are in/out right?

The first one buf is an out yes, the method writes data to that. The second one is in - the method only reads it to know up to how many bytes it can write without overflowing. Noted in:

bitcoin#30205 (comment)

Comment on lines 353 to 356
std::unique_ptr<Sock> DynSock::Accept(sockaddr* addr, socklen_t* addr_len) const
{
return m_accept_sockets->Pop().value_or(nullptr);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vasild would it make sense to modify sockaddr here like you do for ZeroSock::Accept()? Otherwise all client connections appear to originate from [::]:0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants