{"action":"created","comment":{"url":"https://api.github.com/repos/monero-project/kovri/pulls/comments/92909965","pull_request_review_id":13435827,"id":92909965,"diff_hunk":"@@ -60,55 +61,77 @@ std::uint8_t* InputByteStream::ReadBytes(\n   return ptr;\n }\n \n+std::uint64_t InputByteStream::ReadUInt64() {\n+  return bufbe64toh(ReadBytes(sizeof(std::uint64_t)));\n+}\n+\n std::uint32_t InputByteStream::ReadUInt32() {\n-  return bufbe32toh(ReadBytes(4));\n+  return bufbe32toh(ReadBytes(sizeof(std::uint32_t)));\n }\n \n std::uint16_t InputByteStream::ReadUInt16() {\n-  return bufbe16toh(ReadBytes(2));\n+  return bufbe16toh(ReadBytes(sizeof(std::uint16_t)));\n }\n \n std::uint8_t InputByteStream::ReadUInt8() {\n-  return *ReadBytes(1);\n+  return *ReadBytes(sizeof(std::uint8_t));\n }\n \n OutputByteStream::OutputByteStream(\n   std::uint8_t* data,\n   std::size_t len)\n-  : m_Data(data), m_Length(len) { }\n+  : m_Data(data),\n+    m_Length(len),\n+    m_Counter(0),\n+    m_Size(len) {}\n \n void OutputByteStream::ProduceData(std::size_t amount) {\n   if (amount > m_Length)\n-    throw std::length_error(\"SSUPacketParser: too many bytes to produce.\");\n+    throw std::length_error(\"OutputByteStream: too many bytes to produce.\");\n   m_Data += amount;\n   m_Length -= amount;\n+  m_Counter += amount;\n }\n \n void OutputByteStream::WriteData(const std::uint8_t* data, std::size_t len) {\n   std::uint8_t* ptr = m_Data; \n   ProduceData(len);\n-  memcpy(ptr, data, len);\n+  std::memcpy(ptr, data, len);\n }\n \n void OutputByteStream::WriteUInt8(std::uint8_t data) {\n-  WriteData(&data, 1);\n+  WriteData(&data, sizeof(std::uint8_t));\n }\n \n void OutputByteStream::WriteUInt16(std::uint16_t data) {\n-  std::uint8_t buf[2] = {};\n+  std::uint8_t buf[sizeof(std::uint16_t)] = {};\n   htobe16buf(buf, data);\n   WriteData(buf, sizeof(buf));\n }\n \n void OutputByteStream::WriteUInt32(std::uint32_t data) {\n-  std::uint8_t buf[4] = {};\n+  std::uint8_t buf[sizeof(std::uint32_t)] = {};\n   htobe32buf(buf, data);\n   WriteData(buf, sizeof(buf));\n }\n \n+void OutputByteStream::WriteUInt64(std::uint64_t data) {\n+  std::uint8_t buf[sizeof(std::uint64_t)] = {};\n+  htobe64buf(buf, data);\n+  WriteData(buf, sizeof(buf));\n+}\n+\n std::uint8_t* OutputByteStream::GetPosition() const {\n   return m_Data;\n }\n \n+std::uint8_t* OutputByteStream::GetData() const {","path":"src/core/util/byte_stream.cc","position":94,"original_position":94,"commit_id":"a90d3c22c04f0457d1040850208ffed15c8e6523","original_commit_id":"a90d3c22c04f0457d1040850208ffed15c8e6523","user":{"login":"anonimal","id":12156341,"avatar_url":"https://avatars.githubusercontent.com/u/12156341?v=3","gravatar_id":"","url":"https://api.github.com/users/anonimal","html_url":"https://github.com/anonimal","followers_url":"https://api.github.com/users/anonimal/followers","following_url":"https://api.github.com/users/anonimal/following{/other_user}","gists_url":"https://api.github.com/users/anonimal/gists{/gist_id}","starred_url":"https://api.github.com/users/anonimal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anonimal/subscriptions","organizations_url":"https://api.github.com/users/anonimal/orgs","repos_url":"https://api.github.com/users/anonimal/repos","events_url":"https://api.github.com/users/anonimal/events{/privacy}","received_events_url":"https://api.github.com/users/anonimal/received_events","type":"User","site_admin":false},"body":"@EinMByte wrote these bytestream classes, so maybe he has his reasons. As for `TunnelHopConfig`, I almost *always* place getters/setters in header but I specifically chose not to for `TunnelHopConfig` purely out of aesthetics and maintainability (tunnel logic is tricky at times and I needed a clean slate to work on). I'm flexible in either case though because #511 is now open and there is a good trade-off in favor of optimization in this area.","created_at":"2016-12-17T01:01:02Z","updated_at":"2016-12-17T01:01:02Z","html_url":"https://github.com/monero-project/kovri/pull/510#discussion_r92909965","pull_request_url":"https://api.github.com/repos/monero-project/kovri/pulls/510","_links":{"self":{"href":"https://api.github.com/repos/monero-project/kovri/pulls/comments/92909965"},"html":{"href":"https://github.com/monero-project/kovri/pull/510#discussion_r92909965"},"pull_request":{"href":"https://api.github.com/repos/monero-project/kovri/pulls/510"}}},"pull_request":{"url":"https://api.github.com/repos/monero-project/kovri/pulls/510","id":98418376,"html_url":"https://github.com/monero-project/kovri/pull/510","diff_url":"https://github.com/monero-project/kovri/pull/510.diff","patch_url":"https://github.com/monero-project/kovri/pull/510.patch","issue_url":"https://api.github.com/repos/monero-project/kovri/issues/510","number":510,"state":"open","locked":false,"title":"TunnelHopConfig + I/O ByteStream: fixes + refactoring + documentation. Closes #355","user":{"login":"anonimal","id":12156341,"avatar_url":"https://avatars.githubusercontent.com/u/12156341?v=3","gravatar_id":"","url":"https://api.github.com/users/anonimal","html_url":"https://github.com/anonimal","followers_url":"https://api.github.com/users/anonimal/followers","following_url":"https://api.github.com/users/anonimal/following{/other_user}","gists_url":"https://api.github.com/users/anonimal/gists{/gist_id}","starred_url":"https://api.github.com/users/anonimal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anonimal/subscriptions","organizations_url":"https://api.github.com/users/anonimal/orgs","repos_url":"https://api.github.com/users/anonimal/repos","events_url":"https://api.github.com/users/anonimal/events{/privacy}","received_events_url":"https://api.github.com/users/anonimal/received_events","type":"User","site_admin":false},"body":"**By submitting this pull-request, I confirm the following:**\r\n\r\n- I have read and understood the [Contributing Guide](https://github.com/monero-project/kovri/blob/master/doc/CONTRIBUTING.md).\r\n- I have checked that another pull-request for this purpose does not exist.\r\n- I have considered and confirmed that this submission will be valuable to others.\r\n- I accept that this submission may not be used and that this pull-request may be closed by the will of the maintainer.\r\n- I give this submission freely under the BSD 3-clause license.\r\n\r\n*Place an X inside the bracket (or click the box in preview) to confirm*\r\n- [X] I confirm.\r\n\r\n---\r\n\r\nRegarding #355, if the issue is a null router info, this branch should deal appropriately. If (as mentioned in ticket) the issue is indeed a null router identity, then I'll need a real backtrace because there is nothing glaringly obvious outside of painfully convoluted tunnel code and the need to resolve #366.\r\n\r\nLive tests pass. Closes #355 ","created_at":"2016-12-16T23:13:08Z","updated_at":"2016-12-17T01:01:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93e508f5a94e21fb730877b91171ecc6422b37da","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/monero-project/kovri/pulls/510/commits","review_comments_url":"https://api.github.com/repos/monero-project/kovri/pulls/510/comments","review_comment_url":"https://api.github.com/repos/monero-project/kovri/pulls/comments{/number}","comments_url":"https://api.github.com/repos/monero-project/kovri/issues/510/comments","statuses_url":"https://api.github.com/repos/monero-project/kovri/statuses/a90d3c22c04f0457d1040850208ffed15c8e6523","head":{"label":"anonimal:fix-355","ref":"fix-355","sha":"a90d3c22c04f0457d1040850208ffed15c8e6523","user":{"login":"anonimal","id":12156341,"avatar_url":"https://avatars.githubusercontent.com/u/12156341?v=3","gravatar_id":"","url":"https://api.github.com/users/anonimal","html_url":"https://github.com/anonimal","followers_url":"https://api.github.com/users/anonimal/followers","following_url":"https://api.github.com/users/anonimal/following{/other_user}","gists_url":"https://api.github.com/users/anonimal/gists{/gist_id}","starred_url":"https://api.github.com/users/anonimal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anonimal/subscriptions","organizations_url":"https://api.github.com/users/anonimal/orgs","repos_url":"https://api.github.com/users/anonimal/repos","events_url":"https://api.github.com/users/anonimal/events{/privacy}","received_events_url":"https://api.github.com/users/anonimal/received_events","type":"User","site_admin":false},"repo":{"id":50646302,"name":"kovri","full_name":"anonimal/kovri","owner":{"login":"anonimal","id":12156341,"avatar_url":"https://avatars.githubusercontent.com/u/12156341?v=3","gravatar_id":"","url":"https://api.github.com/users/anonimal","html_url":"https://github.com/anonimal","followers_url":"https://api.github.com/users/anonimal/followers","following_url":"https://api.github.com/users/anonimal/following{/other_user}","gists_url":"https://api.github.com/users/anonimal/gists{/gist_id}","starred_url":"https://api.github.com/users/anonimal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anonimal/subscriptions","organizations_url":"https://api.github.com/users/anonimal/orgs","repos_url":"https://api.github.com/users/anonimal/repos","events_url":"https://api.github.com/users/anonimal/events{/privacy}","received_events_url":"https://api.github.com/users/anonimal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anonimal/kovri","description":"The Kovri I2P Router Project","fork":true,"url":"https://api.github.com/repos/anonimal/kovri","forks_url":"https://api.github.com/repos/anonimal/kovri/forks","keys_url":"https://api.github.com/repos/anonimal/kovri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anonimal/kovri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anonimal/kovri/teams","hooks_url":"https://api.github.com/repos/anonimal/kovri/hooks","issue_events_url":"https://api.github.com/repos/anonimal/kovri/issues/events{/number}","events_url":"https://api.github.com/repos/anonimal/kovri/events","assignees_url":"https://api.github.com/repos/anonimal/kovri/assignees{/user}","branches_url":"https://api.github.com/repos/anonimal/kovri/branches{/branch}","tags_url":"https://api.github.com/repos/anonimal/kovri/tags","blobs_url":"https://api.github.com/repos/anonimal/kovri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anonimal/kovri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anonimal/kovri/git/refs{/sha}","trees_url":"https://api.github.com/repos/anonimal/kovri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anonimal/kovri/statuses/{sha}","languages_url":"https://api.github.com/repos/anonimal/kovri/languages","stargazers_url":"https://api.github.com/repos/anonimal/kovri/stargazers","contributors_url":"https://api.github.com/repos/anonimal/kovri/contributors","subscribers_url":"https://api.github.com/repos/anonimal/kovri/subscribers","subscription_url":"https://api.github.com/repos/anonimal/kovri/subscription","commits_url":"https://api.github.com/repos/anonimal/kovri/commits{/sha}","git_commits_url":"https://api.github.com/repos/anonimal/kovri/git/commits{/sha}","comments_url":"https://api.github.com/repos/anonimal/kovri/comments{/number}","issue_comment_url":"https://api.github.com/repos/anonimal/kovri/issues/comments{/number}","contents_url":"https://api.github.com/repos/anonimal/kovri/contents/{+path}","compare_url":"https://api.github.com/repos/anonimal/kovri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anonimal/kovri/merges","archive_url":"https://api.github.com/repos/anonimal/kovri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anonimal/kovri/downloads","issues_url":"https://api.github.com/repos/anonimal/kovri/issues{/number}","pulls_url":"https://api.github.com/repos/anonimal/kovri/pulls{/number}","milestones_url":"https://api.github.com/repos/anonimal/kovri/milestones{/number}","notifications_url":"https://api.github.com/repos/anonimal/kovri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anonimal/kovri/labels{/name}","releases_url":"https://api.github.com/repos/anonimal/kovri/releases{/id}","deployments_url":"https://api.github.com/repos/anonimal/kovri/deployments","created_at":"2016-01-29T07:31:37Z","updated_at":"2016-10-24T18:15:28Z","pushed_at":"2016-12-16T22:52:37Z","git_url":"git://github.com/anonimal/kovri.git","ssh_url":"git@github.com:anonimal/kovri.git","clone_url":"https://github.com/anonimal/kovri.git","svn_url":"https://github.com/anonimal/kovri","homepage":"","size":7352,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"monero-project:master","ref":"master","sha":"0b9eaf4ee73531b50e77ca195f6c21324bbe7180","user":{"login":"monero-project","id":7450663,"avatar_url":"https://avatars.githubusercontent.com/u/7450663?v=3","gravatar_id":"","url":"https://api.github.com/users/monero-project","html_url":"https://github.com/monero-project","followers_url":"https://api.github.com/users/monero-project/followers","following_url":"https://api.github.com/users/monero-project/following{/other_user}","gists_url":"https://api.github.com/users/monero-project/gists{/gist_id}","starred_url":"https://api.github.com/users/monero-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monero-project/subscriptions","organizations_url":"https://api.github.com/users/monero-project/orgs","repos_url":"https://api.github.com/users/monero-project/repos","events_url":"https://api.github.com/users/monero-project/events{/privacy}","received_events_url":"https://api.github.com/users/monero-project/received_events","type":"User","site_admin":false},"repo":{"id":46236248,"name":"kovri","full_name":"monero-project/kovri","owner":{"login":"monero-project","id":7450663,"avatar_url":"https://avatars.githubusercontent.com/u/7450663?v=3","gravatar_id":"","url":"https://api.github.com/users/monero-project","html_url":"https://github.com/monero-project","followers_url":"https://api.github.com/users/monero-project/followers","following_url":"https://api.github.com/users/monero-project/following{/other_user}","gists_url":"https://api.github.com/users/monero-project/gists{/gist_id}","starred_url":"https://api.github.com/users/monero-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monero-project/subscriptions","organizations_url":"https://api.github.com/users/monero-project/orgs","repos_url":"https://api.github.com/users/monero-project/repos","events_url":"https://api.github.com/users/monero-project/events{/privacy}","received_events_url":"https://api.github.com/users/monero-project/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/monero-project/kovri","description":"The Kovri I2P Router Project","fork":false,"url":"https://api.github.com/repos/monero-project/kovri","forks_url":"https://api.github.com/repos/monero-project/kovri/forks","keys_url":"https://api.github.com/repos/monero-project/kovri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monero-project/kovri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monero-project/kovri/teams","hooks_url":"https://api.github.com/repos/monero-project/kovri/hooks","issue_events_url":"https://api.github.com/repos/monero-project/kovri/issues/events{/number}","events_url":"https://api.github.com/repos/monero-project/kovri/events","assignees_url":"https://api.github.com/repos/monero-project/kovri/assignees{/user}","branches_url":"https://api.github.com/repos/monero-project/kovri/branches{/branch}","tags_url":"https://api.github.com/repos/monero-project/kovri/tags","blobs_url":"https://api.github.com/repos/monero-project/kovri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monero-project/kovri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monero-project/kovri/git/refs{/sha}","trees_url":"https://api.github.com/repos/monero-project/kovri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monero-project/kovri/statuses/{sha}","languages_url":"https://api.github.com/repos/monero-project/kovri/languages","stargazers_url":"https://api.github.com/repos/monero-project/kovri/stargazers","contributors_url":"https://api.github.com/repos/monero-project/kovri/contributors","subscribers_url":"https://api.github.com/repos/monero-project/kovri/subscribers","subscription_url":"https://api.github.com/repos/monero-project/kovri/subscription","commits_url":"https://api.github.com/repos/monero-project/kovri/commits{/sha}","git_commits_url":"https://api.github.com/repos/monero-project/kovri/git/commits{/sha}","comments_url":"https://api.github.com/repos/monero-project/kovri/comments{/number}","issue_comment_url":"https://api.github.com/repos/monero-project/kovri/issues/comments{/number}","contents_url":"https://api.github.com/repos/monero-project/kovri/contents/{+path}","compare_url":"https://api.github.com/repos/monero-project/kovri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monero-project/kovri/merges","archive_url":"https://api.github.com/repos/monero-project/kovri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monero-project/kovri/downloads","issues_url":"https://api.github.com/repos/monero-project/kovri/issues{/number}","pulls_url":"https://api.github.com/repos/monero-project/kovri/pulls{/number}","milestones_url":"https://api.github.com/repos/monero-project/kovri/milestones{/number}","notifications_url":"https://api.github.com/repos/monero-project/kovri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monero-project/kovri/labels{/name}","releases_url":"https://api.github.com/repos/monero-project/kovri/releases{/id}","deployments_url":"https://api.github.com/repos/monero-project/kovri/deployments","created_at":"2015-11-15T21:18:13Z","updated_at":"2016-12-09T22:54:58Z","pushed_at":"2016-12-16T23:13:09Z","git_url":"git://github.com/monero-project/kovri.git","ssh_url":"git@github.com:monero-project/kovri.git","clone_url":"https://github.com/monero-project/kovri.git","svn_url":"https://github.com/monero-project/kovri","homepage":"","size":7515,"stargazers_count":60,"watchers_count":60,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":74,"forks":22,"open_issues":74,"watchers":60,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/monero-project/kovri/pulls/510"},"html":{"href":"https://github.com/monero-project/kovri/pull/510"},"issue":{"href":"https://api.github.com/repos/monero-project/kovri/issues/510"},"comments":{"href":"https://api.github.com/repos/monero-project/kovri/issues/510/comments"},"review_comments":{"href":"https://api.github.com/repos/monero-project/kovri/pulls/510/comments"},"review_comment":{"href":"https://api.github.com/repos/monero-project/kovri/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/monero-project/kovri/pulls/510/commits"},"statuses":{"href":"https://api.github.com/repos/monero-project/kovri/statuses/a90d3c22c04f0457d1040850208ffed15c8e6523"}}}}
{"actor":{"display_login":"anonimal"}}