Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

RouterInfo: refactoring + documentation + optimizations + exception handling #636

Merged
merged 13 commits into from
May 8, 2017

Conversation

anonimal
Copy link
Collaborator

@anonimal anonimal commented May 6, 2017

WIP. Referencing #627.


By submitting this pull-request, I confirm the following:

  • I have read and understood the Contributing Guide.
  • I have checked that another pull-request for this purpose does not exist.
  • I have considered and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used and that this pull-request may be closed by the will of the maintainer.
  • I give this submission freely under the BSD 3-clause license.

@anonimal
Copy link
Collaborator Author

anonimal commented May 6, 2017

Dropped 33db5e4 as it jumped-the-gun and ignored the fact that an interface or buffer refactor would first be needed. Leaving the buffer loading TODO where it is.

@anonimal
Copy link
Collaborator Author

anonimal commented May 6, 2017

Pushed d4e66a0.

@anonimal anonimal changed the title RouterInfo: refactoring + optimizations + exception handling RouterInfo: refactoring + documentation + optimizations + exception handling May 6, 2017
{
if (!buf)
throw std::invalid_argument("RouterInfo: null buffer");
if (len < Size::MinBuffer || len > Size::MaxBuffer)
throw std::length_error("RouterInfo: invalid buffer length");
memcpy(m_Buffer.get(), buf, Size::MaxBuffer);
std::memcpy(m_Buffer.get(), buf, Size::MaxBuffer);
Copy link
Contributor

Choose a reason for hiding this comment

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

"len" instead of "Size::MaxBuffer" (required to test #635)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, thanks. I kept for continuity since this would be fixed by the buffer refactor (noted in TODO). Since you're working with #635, I'll make this change now.

References monero-project#636. Note: see buffer refactor TODO.
@anonimal anonimal merged commit 509676c into monero-project:master May 8, 2017
anonimal added a commit that referenced this pull request May 8, 2017
509676c RouterInfo: copy RI length instead of max buffer (anonimal)
d4e66a0 RouterInfo: remove unnecessary assignment from buffer getter (anonimal)
5c5751b RouterInfo: add exception handling to buffer creator (anonimal)
d1dd466 RouterInfo: add exception handling to buffer reader (anonimal)
038abb6 RouterInfo: add exception handling to file reader (anonimal)
55c8f4c RouterInfo: create POD class RouterInfoTraits (anonimal)
1e3e3ff RouterInfo: layout logic / style refactor (anonimal)
b0055d6 RouterInfo: remove unnecessary reinterpret_cast (anonimal)
31cad05 RouterInfo: add function documentation (anonimal)
4b54b8f RouterInfo: remove C headers, use std::memcpy (anonimal)
11fb231 RouterInfo: optimize various inline getters (anonimal)
107947b RouterInfo: inline + optimize introducer cap test (anonimal)
ec3a5f8 RouterInfo: remove logging from HasCap + optimize (anonimal)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants