{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/63897759","id":63897759,"diff_hunk":"@@ -358,14 +475,45 @@ func (s *Server) exec(ctx context.Context, codec ServerCodec, req *serverRequest\n // execBatch executes the given requests and writes the result back using the codec.\n // It will only write the response back when the last request is processed.\n func (s *Server) execBatch(ctx context.Context, codec ServerCodec, requests []*serverRequest) {\n+\tlctx := ctx\n+\ts.pendingMu.Lock()\n+\tcodecPending := s.pending[codec]\n+\tvar reqIDs []interface{}\n+\tvar preq *pendingRequest\n+\tif codecPending != nil {\n+\t\treqIDs = make([]interface{}, len(requests))\n+\t\tvar cancelFn func()\n+\t\tlctx, cancelFn = context.WithCancel(ctx)\n+\t\tpreq = &pendingRequest{cancelFn, false}\n+\t\tfor i, req := range requests {\n+\t\t\treqIDs[i], _ = parseReqId(*req.id.(*json.RawMessage))","path":"rpc/server.go","position":185,"original_position":185,"commit_id":"a57b64f1ea12c051f2fe20c3deae4f179817a182","original_commit_id":"a57b64f1ea12c051f2fe20c3deae4f179817a182","user":{"login":"bas-vk","id":4280775,"avatar_url":"https://avatars.githubusercontent.com/u/4280775?v=3","gravatar_id":"","url":"https://api.github.com/users/bas-vk","html_url":"https://github.com/bas-vk","followers_url":"https://api.github.com/users/bas-vk/followers","following_url":"https://api.github.com/users/bas-vk/following{/other_user}","gists_url":"https://api.github.com/users/bas-vk/gists{/gist_id}","starred_url":"https://api.github.com/users/bas-vk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bas-vk/subscriptions","organizations_url":"https://api.github.com/users/bas-vk/orgs","repos_url":"https://api.github.com/users/bas-vk/repos","events_url":"https://api.github.com/users/bas-vk/events{/privacy}","received_events_url":"https://api.github.com/users/bas-vk/received_events","type":"User","site_admin":false},"body":"Can't you use something like: `reqIDs[i], _ = req.id`?\r\nThe json codec already parsed and checked the request id.","created_at":"2016-05-19T15:17:12Z","updated_at":"2016-05-19T15:17:12Z","html_url":"https://github.com/ethereum/go-ethereum/pull/2541#discussion_r63897759","pull_request_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541","_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/63897759"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/2541#discussion_r63897759"},"pull_request":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541","id":69583736,"html_url":"https://github.com/ethereum/go-ethereum/pull/2541","diff_url":"https://github.com/ethereum/go-ethereum/pull/2541.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/2541.patch","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2541","number":2541,"state":"open","locked":false,"title":"rpc: implemented Cancel and Pending methods","user":{"login":"zsfelfoldi","id":9884311,"avatar_url":"https://avatars.githubusercontent.com/u/9884311?v=3","gravatar_id":"","url":"https://api.github.com/users/zsfelfoldi","html_url":"https://github.com/zsfelfoldi","followers_url":"https://api.github.com/users/zsfelfoldi/followers","following_url":"https://api.github.com/users/zsfelfoldi/following{/other_user}","gists_url":"https://api.github.com/users/zsfelfoldi/gists{/gist_id}","starred_url":"https://api.github.com/users/zsfelfoldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsfelfoldi/subscriptions","organizations_url":"https://api.github.com/users/zsfelfoldi/orgs","repos_url":"https://api.github.com/users/zsfelfoldi/repos","events_url":"https://api.github.com/users/zsfelfoldi/events{/privacy}","received_events_url":"https://api.github.com/users/zsfelfoldi/received_events","type":"User","site_admin":false},"body":"This PR implements rpc_cancel and rpc_pending methods which allows the client to list or cancel currently pending (blocking) requests that were initiated from the same channel.","created_at":"2016-05-10T21:47:39Z","updated_at":"2016-05-19T15:17:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1bdc1d2a52d9a6c93bcb6af04fcd4ae1fbf049e","assignee":null,"milestone":{"url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/26","html_url":"https://github.com/ethereum/go-ethereum/milestones/1.5.0","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/26/labels","id":1593424,"number":26,"title":"1.5.0","description":"","creator":{"login":"karalabe","id":129561,"avatar_url":"https://avatars.githubusercontent.com/u/129561?v=3","gravatar_id":"","url":"https://api.github.com/users/karalabe","html_url":"https://github.com/karalabe","followers_url":"https://api.github.com/users/karalabe/followers","following_url":"https://api.github.com/users/karalabe/following{/other_user}","gists_url":"https://api.github.com/users/karalabe/gists{/gist_id}","starred_url":"https://api.github.com/users/karalabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karalabe/subscriptions","organizations_url":"https://api.github.com/users/karalabe/orgs","repos_url":"https://api.github.com/users/karalabe/repos","events_url":"https://api.github.com/users/karalabe/events{/privacy}","received_events_url":"https://api.github.com/users/karalabe/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":5,"state":"open","created_at":"2016-02-19T15:55:33Z","updated_at":"2016-05-17T09:17:09Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541/commits","review_comments_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541/comments","review_comment_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2541/comments","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/a57b64f1ea12c051f2fe20c3deae4f179817a182","head":{"label":"zsfelfoldi:rpc-cancel","ref":"rpc-cancel","sha":"a57b64f1ea12c051f2fe20c3deae4f179817a182","user":{"login":"zsfelfoldi","id":9884311,"avatar_url":"https://avatars.githubusercontent.com/u/9884311?v=3","gravatar_id":"","url":"https://api.github.com/users/zsfelfoldi","html_url":"https://github.com/zsfelfoldi","followers_url":"https://api.github.com/users/zsfelfoldi/followers","following_url":"https://api.github.com/users/zsfelfoldi/following{/other_user}","gists_url":"https://api.github.com/users/zsfelfoldi/gists{/gist_id}","starred_url":"https://api.github.com/users/zsfelfoldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsfelfoldi/subscriptions","organizations_url":"https://api.github.com/users/zsfelfoldi/orgs","repos_url":"https://api.github.com/users/zsfelfoldi/repos","events_url":"https://api.github.com/users/zsfelfoldi/events{/privacy}","received_events_url":"https://api.github.com/users/zsfelfoldi/received_events","type":"User","site_admin":false},"repo":{"id":35270492,"name":"go-ethereum","full_name":"zsfelfoldi/go-ethereum","owner":{"login":"zsfelfoldi","id":9884311,"avatar_url":"https://avatars.githubusercontent.com/u/9884311?v=3","gravatar_id":"","url":"https://api.github.com/users/zsfelfoldi","html_url":"https://github.com/zsfelfoldi","followers_url":"https://api.github.com/users/zsfelfoldi/followers","following_url":"https://api.github.com/users/zsfelfoldi/following{/other_user}","gists_url":"https://api.github.com/users/zsfelfoldi/gists{/gist_id}","starred_url":"https://api.github.com/users/zsfelfoldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsfelfoldi/subscriptions","organizations_url":"https://api.github.com/users/zsfelfoldi/orgs","repos_url":"https://api.github.com/users/zsfelfoldi/repos","events_url":"https://api.github.com/users/zsfelfoldi/events{/privacy}","received_events_url":"https://api.github.com/users/zsfelfoldi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zsfelfoldi/go-ethereum","description":"Jeffrey Wilcke's Go implementation of the Ethereum y/w paper","fork":true,"url":"https://api.github.com/repos/zsfelfoldi/go-ethereum","forks_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/forks","keys_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/teams","hooks_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/events","assignees_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/tags","blobs_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/subscription","commits_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/merges","archive_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/downloads","issues_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/releases{/id}","deployments_url":"https://api.github.com/repos/zsfelfoldi/go-ethereum/deployments","created_at":"2015-05-08T09:23:28Z","updated_at":"2016-05-10T06:14:34Z","pushed_at":"2016-05-17T07:08:38Z","git_url":"git://github.com/zsfelfoldi/go-ethereum.git","ssh_url":"git@github.com:zsfelfoldi/go-ethereum.git","clone_url":"https://github.com/zsfelfoldi/go-ethereum.git","svn_url":"https://github.com/zsfelfoldi/go-ethereum","homepage":"","size":60363,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":5,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"d89e57ea8d35bd98a46244b46189f0f260c3bbce","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":15452919,"name":"go-ethereum","full_name":"ethereum/go-ethereum","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/go-ethereum","description":"Official golang implementation of the Ethereum protocol","fork":false,"url":"https://api.github.com/repos/ethereum/go-ethereum","forks_url":"https://api.github.com/repos/ethereum/go-ethereum/forks","keys_url":"https://api.github.com/repos/ethereum/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/go-ethereum/teams","hooks_url":"https://api.github.com/repos/ethereum/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/go-ethereum/events","assignees_url":"https://api.github.com/repos/ethereum/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/go-ethereum/tags","blobs_url":"https://api.github.com/repos/ethereum/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/ethereum/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/ethereum/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/ethereum/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/ethereum/go-ethereum/subscription","commits_url":"https://api.github.com/repos/ethereum/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/go-ethereum/merges","archive_url":"https://api.github.com/repos/ethereum/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/go-ethereum/downloads","issues_url":"https://api.github.com/repos/ethereum/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/go-ethereum/releases{/id}","deployments_url":"https://api.github.com/repos/ethereum/go-ethereum/deployments","created_at":"2013-12-26T13:05:46Z","updated_at":"2016-05-19T10:46:05Z","pushed_at":"2016-05-19T12:22:24Z","git_url":"git://github.com/ethereum/go-ethereum.git","ssh_url":"git@github.com:ethereum/go-ethereum.git","clone_url":"https://github.com/ethereum/go-ethereum.git","svn_url":"https://github.com/ethereum/go-ethereum","homepage":"http://ethereum.github.io/go-ethereum/","size":160688,"stargazers_count":1491,"watchers_count":1491,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":475,"mirror_url":null,"open_issues_count":225,"forks":475,"open_issues":225,"watchers":1491,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/2541"},"issue":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/2541"},"comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/2541/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2541/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/go-ethereum/statuses/a57b64f1ea12c051f2fe20c3deae4f179817a182"}}}}