This repository has been archived by the owner on Sep 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
RouterInfo: refactoring + documentation + optimizations + exception handling #636
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Remove log spam, not debug/trace worthy (caller should implement) - Optimize with noexcept
- Optimize with noexcept
- Optimize with noexcept
Also removes unnecessary tuple header.
and related TODO's.
and misc doc additions/updates.
- Adds exception class member - Refactors file reader return type
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. |
and update related TODO's.
Pushed d4e66a0. |
anonimal
changed the title
RouterInfo: refactoring + optimizations + exception handling
RouterInfo: refactoring + documentation + optimizations + exception handling
May 6, 2017
src/core/router/info.cc
Outdated
{ | ||
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); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP. Referencing #627.
By submitting this pull-request, I confirm the following: