Skip to content

Instantly share code, notes, and snippets.

@0xB10C
Created May 31, 2023 17:56
Show Gist options
  • Save 0xB10C/7fb0b4c6872e0bbd65c7fe05adebf999 to your computer and use it in GitHub Desktop.
Save 0xB10C/7fb0b4c6872e0bbd65c7fe05adebf999 to your computer and use it in GitHub Desktop.
[package]
name = "tester"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
octocrab = "0.23.0"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
serde = "1.0.163"
serde_json = "1.0.96"
log = "0.4.18"
env_logger = "0.10.0"
[
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1525240",
"pull_request_review_id": null,
"id": 1525240,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MjUyNDA=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "laanwj",
"id": 126646,
"node_id": "MDQ6VXNlcjEyNjY0Ng==",
"avatar_url": "https://avatars.githubusercontent.com/u/126646?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/laanwj",
"html_url": "https://github.com/laanwj",
"followers_url": "https://api.github.com/users/laanwj/followers",
"following_url": "https://api.github.com/users/laanwj/following{/other_user}",
"gists_url": "https://api.github.com/users/laanwj/gists{/gist_id}",
"starred_url": "https://api.github.com/users/laanwj/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/laanwj/subscriptions",
"organizations_url": "https://api.github.com/users/laanwj/orgs",
"repos_url": "https://api.github.com/users/laanwj/repos",
"events_url": "https://api.github.com/users/laanwj/events{/privacy}",
"received_events_url": "https://api.github.com/users/laanwj/received_events",
"type": "User",
"site_admin": false
},
"body": "BTW this <= here is interesting.\n\nhSocketMax is the _maximum_ socket number. Which means that, if it is 0 (which it is initialized with), we still pass 1 into select (which has a parameter \"maximum fd+1\", not \"maximum fd\"). \n\nSo what happens if there is nothing to do? hSocketMax will be 0, however 1 will be passed into select, even though no fds have been set with FD_SET.\n\nHmm the code is fishy. Maybe we should track the maximum of (hSocket+1) instead of hSocket, so we can distinguish the cases _only fd 0 set_ and _no fds set_. This also means that we don't have to increase the number before passing it into select.\n",
"created_at": "2012-09-04T17:26:59Z",
"updated_at": "2012-09-04T17:44:56Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1525240",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "MEMBER",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1525240"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1525240"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1525240/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
},
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1526844",
"pull_request_review_id": null,
"id": 1526844,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MjY4NDQ=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "Diapolo",
"id": 1419649,
"node_id": "MDQ6VXNlcjE0MTk2NDk=",
"avatar_url": "https://avatars.githubusercontent.com/u/1419649?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Diapolo",
"html_url": "https://github.com/Diapolo",
"followers_url": "https://api.github.com/users/Diapolo/followers",
"following_url": "https://api.github.com/users/Diapolo/following{/other_user}",
"gists_url": "https://api.github.com/users/Diapolo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Diapolo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Diapolo/subscriptions",
"organizations_url": "https://api.github.com/users/Diapolo/orgs",
"repos_url": "https://api.github.com/users/Diapolo/repos",
"events_url": "https://api.github.com/users/Diapolo/events{/privacy}",
"received_events_url": "https://api.github.com/users/Diapolo/received_events",
"type": "User",
"site_admin": false
},
"body": "At least on Windows, the first parameter of select is ignored `nfds [in] Ignored. The nfds parameter is included only for compatibility with Berkeley sockets.`, which should be no cause for an error then.\n\nSo hSocketMax is 0, when hListenSocket is 0 or all pnode->hSocket are 0. This results in all fdset vars to contain .fd_count == 0, which results in the select() 10022 error code (`The time-out value is not valid, or all three descriptor parameters were null.`).\n\nThe longer I think about it, the more I feel like NOT calling select() when all fdset vars are empty, which of course is perhaps more expensive in that part of the code, then simply ignoring 10022 - via a check for hSocketMax == 0, which is true, when there are simply none ;).\n\nEdit: That is such a part in the code, where I'm really missing more documentation :-D!\n",
"created_at": "2012-09-04T19:44:10Z",
"updated_at": "2012-09-04T19:47:16Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1526844",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "NONE",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1526844"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1526844"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1526844/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
},
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1526899",
"pull_request_review_id": null,
"id": 1526899,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MjY4OTk=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "laanwj",
"id": 126646,
"node_id": "MDQ6VXNlcjEyNjY0Ng==",
"avatar_url": "https://avatars.githubusercontent.com/u/126646?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/laanwj",
"html_url": "https://github.com/laanwj",
"followers_url": "https://api.github.com/users/laanwj/followers",
"following_url": "https://api.github.com/users/laanwj/following{/other_user}",
"gists_url": "https://api.github.com/users/laanwj/gists{/gist_id}",
"starred_url": "https://api.github.com/users/laanwj/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/laanwj/subscriptions",
"organizations_url": "https://api.github.com/users/laanwj/orgs",
"repos_url": "https://api.github.com/users/laanwj/repos",
"events_url": "https://api.github.com/users/laanwj/events{/privacy}",
"received_events_url": "https://api.github.com/users/laanwj/received_events",
"type": "User",
"site_admin": false
},
"body": "The point is that we currently cannot distinguish between _no fds_ and _a single fd, 0_. Which is wrong. If you make hSocketMax to be max(hSocket+1) this is easy to detect, as the value will be 0 for no fds and 1 for the single fd 0 case. And as a plus, we then pass the correct nfds on UNIX in both cases.\n\n(also, if you do that, you could decide to skip the select when hSocketMax==0. You cannot do so right now, as it has two meanings and thus is ambigious)\n",
"created_at": "2012-09-04T19:51:53Z",
"updated_at": "2012-09-04T19:51:53Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1526899",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "MEMBER",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1526899"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1526899"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1526899/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
},
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527124",
"pull_request_review_id": null,
"id": 1527124,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MjcxMjQ=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "Diapolo",
"id": 1419649,
"node_id": "MDQ6VXNlcjE0MTk2NDk=",
"avatar_url": "https://avatars.githubusercontent.com/u/1419649?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Diapolo",
"html_url": "https://github.com/Diapolo",
"followers_url": "https://api.github.com/users/Diapolo/followers",
"following_url": "https://api.github.com/users/Diapolo/following{/other_user}",
"gists_url": "https://api.github.com/users/Diapolo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Diapolo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Diapolo/subscriptions",
"organizations_url": "https://api.github.com/users/Diapolo/orgs",
"repos_url": "https://api.github.com/users/Diapolo/repos",
"events_url": "https://api.github.com/users/Diapolo/events{/privacy}",
"received_events_url": "https://api.github.com/users/Diapolo/received_events",
"type": "User",
"site_admin": false
},
"body": "I'm thinking for minutes now, but have no clue, where you would like to place max(hSocket + 1) or do you mean max(hSocketMax, hSocket + 1)? And even then it makes no sense yet...\n",
"created_at": "2012-09-04T20:14:15Z",
"updated_at": "2012-09-04T20:14:41Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527124",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "NONE",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527124"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527124"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527124/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
},
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527218",
"pull_request_review_id": null,
"id": 1527218,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1MjcyMTg=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "laanwj",
"id": 126646,
"node_id": "MDQ6VXNlcjEyNjY0Ng==",
"avatar_url": "https://avatars.githubusercontent.com/u/126646?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/laanwj",
"html_url": "https://github.com/laanwj",
"followers_url": "https://api.github.com/users/laanwj/followers",
"following_url": "https://api.github.com/users/laanwj/following{/other_user}",
"gists_url": "https://api.github.com/users/laanwj/gists{/gist_id}",
"starred_url": "https://api.github.com/users/laanwj/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/laanwj/subscriptions",
"organizations_url": "https://api.github.com/users/laanwj/orgs",
"repos_url": "https://api.github.com/users/laanwj/repos",
"events_url": "https://api.github.com/users/laanwj/events{/privacy}",
"received_events_url": "https://api.github.com/users/laanwj/received_events",
"type": "User",
"site_admin": false
},
"body": "Yes,\n\n```\nhSocketMax = max(hSocketMax, hListenSocket + 1);\n...\nhSocketMax = max(hSocketMax, pnode->hSocket + 1);\n```\n\nThen change the select line to (ie, remove the + 1)\n\n```\n int nSelect = select(hSocketMax, &fdsetRecv, &fdsetSend, &fdsetError, &timeout);\n```\n\nAnd change this loop to < i.s.o <=:\n\n```\n for (unsigned int i = 0; i < hSocketMax; i++)\n FD_SET(i, &fdsetRecv);\n```\n\nOnly after that, you can check for hSocketMax==0 and be sure that it means \"no sockets\".\n",
"created_at": "2012-09-04T20:21:28Z",
"updated_at": "2012-09-04T20:21:28Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527218",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "MEMBER",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527218"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527218"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527218/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
},
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527632",
"pull_request_review_id": null,
"id": 1527632,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1Mjc2MzI=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "Diapolo",
"id": 1419649,
"node_id": "MDQ6VXNlcjE0MTk2NDk=",
"avatar_url": "https://avatars.githubusercontent.com/u/1419649?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Diapolo",
"html_url": "https://github.com/Diapolo",
"followers_url": "https://api.github.com/users/Diapolo/followers",
"following_url": "https://api.github.com/users/Diapolo/following{/other_user}",
"gists_url": "https://api.github.com/users/Diapolo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Diapolo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Diapolo/subscriptions",
"organizations_url": "https://api.github.com/users/Diapolo/orgs",
"repos_url": "https://api.github.com/users/Diapolo/repos",
"events_url": "https://api.github.com/users/Diapolo/events{/privacy}",
"received_events_url": "https://api.github.com/users/Diapolo/received_events",
"type": "User",
"site_admin": false
},
"body": "I found out that setting an invalid -proxy leads to not even entering the BOOST_FOREACH loops, as vhListenSocket and vNodes are empty. That means hSocketMax simply keeps the init value of 0, which leads to 10022 spam.\n\nI also did some research for the first select()-parameter and found this:\n\n<pre>The first parameter to select() is the maximum file descriptor that is set in the structs PLUS ONE. That is, if you have 20 file descriptors in the sets, and the maximum value a file descriptor has is 123, then the value passed as the first parameter must be 124.</pre>\n\nThis makes me think the + 1 before hSocketMax in select() is indeed correct and valid.\n",
"created_at": "2012-09-04T20:50:37Z",
"updated_at": "2012-09-04T20:51:59Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527632",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "NONE",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527632"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527632"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527632/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
},
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527717",
"pull_request_review_id": null,
"id": 1527717,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1Mjc3MTc=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "laanwj",
"id": 126646,
"node_id": "MDQ6VXNlcjEyNjY0Ng==",
"avatar_url": "https://avatars.githubusercontent.com/u/126646?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/laanwj",
"html_url": "https://github.com/laanwj",
"followers_url": "https://api.github.com/users/laanwj/followers",
"following_url": "https://api.github.com/users/laanwj/following{/other_user}",
"gists_url": "https://api.github.com/users/laanwj/gists{/gist_id}",
"starred_url": "https://api.github.com/users/laanwj/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/laanwj/subscriptions",
"organizations_url": "https://api.github.com/users/laanwj/orgs",
"repos_url": "https://api.github.com/users/laanwj/repos",
"events_url": "https://api.github.com/users/laanwj/events{/privacy}",
"received_events_url": "https://api.github.com/users/laanwj/received_events",
"type": "User",
"site_admin": false
},
"body": "Yes, that's what I am trying to say all the time. The +1 is valid, however\nit is better to do it at different places, so you can distinguish between\nthe two conditions that I mentioned. Currently you _can not_ reliably\ndetect the condition that causes the error.\n",
"created_at": "2012-09-04T20:55:59Z",
"updated_at": "2012-09-04T20:55:59Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527717",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "MEMBER",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527717"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527717"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527717/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
},
{
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527978",
"pull_request_review_id": null,
"id": 1527978,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE1Mjc5Nzg=",
"diff_hunk": "@@ -781,10 +781,9 @@ void ThreadSocketHandler2(void* parg)\n return;\n if (nSelect == SOCKET_ERROR)\n {\n- int nErr = WSAGetLastError();\n- if (hSocketMax != INVALID_SOCKET)\n+ if ((hSocketMax != INVALID_SOCKET) && (hSocketMax != (SOCKET)0))\n {\n- printf(\"socket select error %d\\n\", nErr);\n+ printf(\"socket select error %d\\n\", WSAGetLastError());\n for (unsigned int i = 0; i <= hSocketMax; i++)",
"path": "src/net.cpp",
"commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"original_commit_id": "8207857f401bc1a48f863be646c5a508a7cdfe9c",
"user": {
"login": "Diapolo",
"id": 1419649,
"node_id": "MDQ6VXNlcjE0MTk2NDk=",
"avatar_url": "https://avatars.githubusercontent.com/u/1419649?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Diapolo",
"html_url": "https://github.com/Diapolo",
"followers_url": "https://api.github.com/users/Diapolo/followers",
"following_url": "https://api.github.com/users/Diapolo/following{/other_user}",
"gists_url": "https://api.github.com/users/Diapolo/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Diapolo/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Diapolo/subscriptions",
"organizations_url": "https://api.github.com/users/Diapolo/orgs",
"repos_url": "https://api.github.com/users/Diapolo/repos",
"events_url": "https://api.github.com/users/Diapolo/events{/privacy}",
"received_events_url": "https://api.github.com/users/Diapolo/received_events",
"type": "User",
"site_admin": false
},
"body": "When I now read the first comment all that makes sense ^^ you are such a patient person :-P.\n\nWith your new code we would pass hSocketMax == 0 to select(), when -proxy is invalid (no BOOST_FOREACH pass), I'm not sure if this is valid. But you are right, when hSocketMax stays 0, we have no fds set, but I'm not sure if it can ever become 1. It would be 1, if vhListenSocket or vNodes is not empty and the contained sockets are == 0.\n\nvhListenSocket is empty, when we are not listening and vNodes if we are not connected to any peers IMO.\n",
"created_at": "2012-09-04T21:23:01Z",
"updated_at": "2012-09-04T21:45:41Z",
"html_url": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527978",
"pull_request_url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772",
"author_association": "NONE",
"_links": {
"self": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527978"
},
"html": {
"href": "https://github.com/bitcoin/bitcoin/pull/1772#discussion_r1527978"
},
"pull_request": {
"href": "https://api.github.com/repos/bitcoin/bitcoin/pulls/1772"
}
},
"reactions": {
"url": "https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/1527978/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"start_line": null,
"original_start_line": null,
"start_side": null,
"line": 787,
"original_line": null,
"side": "RIGHT",
"original_position": 10,
"position": 10,
"subject_type": "line"
}
]
use env_logger::Env;
#[tokio::main]
async fn main() {
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
match octocrab::instance()
.pulls("bitcoin", "bitcoin")
.list_comments(Some(1772))
.per_page(100)
.page(1u32)
.send()
.await {
Ok(_) => println!("it works"),
Err(e) => println!("doesn't work: {:?}", e),
};
}
#[tokio::test]
async fn should_serialize() {
use octocrab::models::pulls::Comment;
let _: Vec<Comment> = serde_json::from_str(include_str!("../comments-1772.json")).unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment