{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/74379447","id":74379447,"diff_hunk":"@@ -83,26 +129,38 @@ type SyncingResult struct {\n \tStatus  Progress `json:\"status\"`\n }\n \n-// Syncing provides information when this nodes starts synchronising with the Ethereum network and when it's finished.\n-func (api *PublicDownloaderAPI) Syncing(ctx context.Context) (rpc.Subscription, error) {\n-\tnotifier, supported := rpc.NotifierFromContext(ctx)\n-\tif !supported {\n-\t\treturn nil, rpc.ErrNotificationsUnsupported\n-\t}\n-\n-\tsubscription, err := notifier.NewSubscription(func(id string) {\n-\t\tapi.muSyncSubscriptions.Lock()\n-\t\tdelete(api.syncSubscriptions, id)\n-\t\tapi.muSyncSubscriptions.Unlock()\n-\t})\n+type uninstallSyncStatusSubscription struct {\n+\tc           chan interface{}\n+\tuninstalled chan interface{}\n+}\n \n-\tif err != nil {\n-\t\treturn nil, err\n-\t}\n+type syncStatusSubscription struct {\n+\tapi       *PublicDownloaderAPI\n+\tc         chan interface{}\n+\tunsubOnce sync.Once\n+}\n \n-\tapi.muSyncSubscriptions.Lock()\n-\tapi.syncSubscriptions[subscription.ID()] = subscription\n-\tapi.muSyncSubscriptions.Unlock()\n+// Unsubscribe cancels subscription. The status channel that wis given during subscribe isn't\n+// be used after this method returns.\n+func (s *syncStatusSubscription) Unsubscribe() {\n+\ts.unsubOnce.Do(func() {\n+\t\treq := uninstallSyncStatusSubscription{s.c, make(chan interface{})}\n+\t\ts.api.uninstallSyncSubscription <- &req\n+\n+\t\tfor {\n+\t\t\tselect {\n+\t\t\tcase <-s.c:\n+\t\t\t\t// drop new status events until uninstall confirmation\n+\t\t\t\tcontinue\n+\t\t\tcase <-req.uninstalled:\n+\t\t\t\treturn\n+\t\t\t}\n+\t\t}\n+\t})\n+}\n \n-\treturn subscription, nil\n+// SubscribeSyncStatus creates a subscription that will broadcast new synchronisation statuses.\n+func (api *PublicDownloaderAPI) SubscribeSyncStatus(status chan interface{}) *syncStatusSubscription {","path":"eth/downloader/api.go","position":180,"original_position":180,"commit_id":"ca674a5cb0b81ec58e202e742b985c1595fc3a2a","original_commit_id":"ca674a5cb0b81ec58e202e742b985c1595fc3a2a","user":{"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},"body":"Shouldn't this be private? As it's returning an internal type that won't be usable from the outside?","created_at":"2016-08-11T07:43:26Z","updated_at":"2016-08-11T07:43:26Z","html_url":"https://github.com/ethereum/go-ethereum/pull/2885#discussion_r74379447","pull_request_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2885","_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/74379447"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/2885#discussion_r74379447"},"pull_request":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2885"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2885","id":79726211,"html_url":"https://github.com/ethereum/go-ethereum/pull/2885","diff_url":"https://github.com/ethereum/go-ethereum/pull/2885.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/2885.patch","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2885","number":2885,"state":"open","locked":false,"title":"rpc: refactor subscriptions and filters","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":"This PR rewrites the subscription and filter system to make it better testable and in line with the subscription structure used by the RPC client.","created_at":"2016-08-02T12:28:24Z","updated_at":"2016-08-11T07:43:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21ea6e7bb98ac3eafab0d4872545f2b7e98bf3a4","assignee":{"login":"fjl","id":6915,"avatar_url":"https://avatars.githubusercontent.com/u/6915?v=3","gravatar_id":"","url":"https://api.github.com/users/fjl","html_url":"https://github.com/fjl","followers_url":"https://api.github.com/users/fjl/followers","following_url":"https://api.github.com/users/fjl/following{/other_user}","gists_url":"https://api.github.com/users/fjl/gists{/gist_id}","starred_url":"https://api.github.com/users/fjl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fjl/subscriptions","organizations_url":"https://api.github.com/users/fjl/orgs","repos_url":"https://api.github.com/users/fjl/repos","events_url":"https://api.github.com/users/fjl/events{/privacy}","received_events_url":"https://api.github.com/users/fjl/received_events","type":"User","site_admin":false},"assignees":[{"login":"fjl","id":6915,"avatar_url":"https://avatars.githubusercontent.com/u/6915?v=3","gravatar_id":"","url":"https://api.github.com/users/fjl","html_url":"https://github.com/fjl","followers_url":"https://api.github.com/users/fjl/followers","following_url":"https://api.github.com/users/fjl/following{/other_user}","gists_url":"https://api.github.com/users/fjl/gists{/gist_id}","starred_url":"https://api.github.com/users/fjl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fjl/subscriptions","organizations_url":"https://api.github.com/users/fjl/orgs","repos_url":"https://api.github.com/users/fjl/repos","events_url":"https://api.github.com/users/fjl/events{/privacy}","received_events_url":"https://api.github.com/users/fjl/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2885/commits","review_comments_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2885/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/2885/comments","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/ca674a5cb0b81ec58e202e742b985c1595fc3a2a","head":{"label":"bas-vk:subscriptions","ref":"subscriptions","sha":"ca674a5cb0b81ec58e202e742b985c1595fc3a2a","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},"repo":{"id":33240025,"name":"go-ethereum","full_name":"bas-vk/go-ethereum","owner":{"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},"private":false,"html_url":"https://github.com/bas-vk/go-ethereum","description":"Jeffrey Wilcke's Go implementation of the Ethereum y/w paper","fork":true,"url":"https://api.github.com/repos/bas-vk/go-ethereum","forks_url":"https://api.github.com/repos/bas-vk/go-ethereum/forks","keys_url":"https://api.github.com/repos/bas-vk/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bas-vk/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bas-vk/go-ethereum/teams","hooks_url":"https://api.github.com/repos/bas-vk/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/bas-vk/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/bas-vk/go-ethereum/events","assignees_url":"https://api.github.com/repos/bas-vk/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/bas-vk/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/bas-vk/go-ethereum/tags","blobs_url":"https://api.github.com/repos/bas-vk/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bas-vk/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bas-vk/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/bas-vk/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bas-vk/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/bas-vk/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/bas-vk/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/bas-vk/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/bas-vk/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/bas-vk/go-ethereum/subscription","commits_url":"https://api.github.com/repos/bas-vk/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/bas-vk/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/bas-vk/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/bas-vk/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/bas-vk/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/bas-vk/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bas-vk/go-ethereum/merges","archive_url":"https://api.github.com/repos/bas-vk/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bas-vk/go-ethereum/downloads","issues_url":"https://api.github.com/repos/bas-vk/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/bas-vk/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/bas-vk/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/bas-vk/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bas-vk/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/bas-vk/go-ethereum/releases{/id}","deployments_url":"https://api.github.com/repos/bas-vk/go-ethereum/deployments","created_at":"2015-04-01T09:53:33Z","updated_at":"2016-06-01T14:26:25Z","pushed_at":"2016-08-07T09:24:23Z","git_url":"git://github.com/bas-vk/go-ethereum.git","ssh_url":"git@github.com:bas-vk/go-ethereum.git","clone_url":"https://github.com/bas-vk/go-ethereum.git","svn_url":"https://github.com/bas-vk/go-ethereum","homepage":"","size":59932,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"b8ba80bff70bedb59385e35f11de18679f3b4967","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-08-11T04:08:50Z","pushed_at":"2016-08-10T17:55:26Z","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":167674,"stargazers_count":1972,"watchers_count":1972,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":645,"mirror_url":null,"open_issues_count":297,"forks":645,"open_issues":297,"watchers":1972,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2885"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/2885"},"issue":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/2885"},"comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/2885/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2885/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/2885/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/go-ethereum/statuses/ca674a5cb0b81ec58e202e742b985c1595fc3a2a"}}}}
{"actor":{"display_login":"karalabe"}}