{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/kbfs/pulls/comments/194162707","pull_request_review_id":127291882,"id":194162707,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDE2MjcwNw==","diff_hunk":"@@ -250,64 +272,54 @@ func (k *KeybaseDaemonRPC) AddProtocols(protocols []rpc.Protocol) {\n \tif protocols == nil {\n \t\treturn\n \t}\n+\n+\tk.lock.Lock()\n+\tdefer k.lock.Unlock()\n+\n \tif k.protocols != nil {\n \t\tk.protocols = append(k.protocols, protocols...)\n \t} else {\n \t\tk.protocols = protocols\n \t}\n+\n+\t// If we are already connected, register these protocols.\n+\tif k.server != nil {\n+\t\tfor _, p := range protocols {\n+\t\t\terr := k.server.Register(p)\n+\t\t\tif err != nil {\n+\t\t\t\tk.log.Warning(\"add protocol %q error\", p.Name)\n+\t\t\t}\n+\t\t}\n+\t}\n }\n \n // OnConnect implements the ConnectionHandler interface.\n func (k *KeybaseDaemonRPC) OnConnect(ctx context.Context,\n \tconn *rpc.Connection, rawClient rpc.GenericClient,\n-\tserver *rpc.Server) error {\n-\n-\t// Protocols that KBFS requires\n-\tprotocols := []rpc.Protocol{\n-\t\tkeybase1.LogUiProtocol(daemonLogUI{k.daemonLog}),\n-\t\tkeybase1.IdentifyUiProtocol(daemonIdentifyUI{k.daemonLog}),\n-\t\tkeybase1.NotifySessionProtocol(k),\n-\t\tkeybase1.NotifyKeyfamilyProtocol(k),\n-\t\tkeybase1.NotifyPaperKeyProtocol(k),\n-\t\tkeybase1.NotifyFSRequestProtocol(k),\n-\t\tkeybase1.NotifyTeamProtocol(k),\n-\t\tkeybase1.TlfKeysProtocol(k),\n-\t\tkeybase1.ReachabilityProtocol(k),\n-\t\tkeybase1.ImplicitTeamMigrationProtocol(k),\n-\t}\n-\n-\t// Add simplefs if set\n-\tif k.simplefs != nil {\n-\t\tprotocols = append(protocols, keybase1.SimpleFSProtocol(k.simplefs))\n-\t}\n-\n-\t// Add git if set\n-\tif k.gitHandler != nil {\n-\t\tprotocols = append(protocols, keybase1.KBFSGitProtocol(k.gitHandler))\n-\t}\n-\n-\tif k.protocols != nil {\n-\t\tprotocols = append(protocols, k.protocols...)\n-\t}\n-\n-\tif k.notifyService != nil {\n-\t\tk.log.Warning(\"adding NotifyService protocol\")\n-\t\tprotocols = append(protocols, keybase1.NotifyServiceProtocol(k.notifyService))\n-\t}\n-\n-\tfor _, p := range protocols {\n-\t\terr := server.Register(p)\n-\t\tif err != nil {\n-\t\t\tif _, ok := err.(rpc.AlreadyRegisteredError); !ok {\n+\tserver *rpc.Server) (err error) {\n+\terr = func() error {\n+\t\tk.lock.RLock()\n+\t\tdefer k.lock.RUnlock()\n+\n+\t\tfor _, p := range k.protocols {\n+\t\t\terr := server.Register(p)\n+\t\t\tswitch err.(type) {\n+\t\t\tcase nil, rpc.AlreadyRegisteredError:","path":"libkbfs/keybase_daemon_rpc.go","position":152,"original_position":152,"commit_id":"bd264902ff80a7a1c0390d50bc00c15a18344b02","original_commit_id":"bd264902ff80a7a1c0390d50bc00c15a18344b02","user":{"login":"jzila","id":59594,"node_id":"MDQ6VXNlcjU5NTk0","avatar_url":"https://avatars1.githubusercontent.com/u/59594?v=4","gravatar_id":"","url":"https://api.github.com/users/jzila","html_url":"https://github.com/jzila","followers_url":"https://api.github.com/users/jzila/followers","following_url":"https://api.github.com/users/jzila/following{/other_user}","gists_url":"https://api.github.com/users/jzila/gists{/gist_id}","starred_url":"https://api.github.com/users/jzila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzila/subscriptions","organizations_url":"https://api.github.com/users/jzila/orgs","repos_url":"https://api.github.com/users/jzila/repos","events_url":"https://api.github.com/users/jzila/events{/privacy}","received_events_url":"https://api.github.com/users/jzila/received_events","type":"User","site_admin":false},"body":"nice, even better than my suggestion!","created_at":"2018-06-08T19:44:50Z","updated_at":"2018-06-08T19:44:50Z","html_url":"https://github.com/keybase/kbfs/pull/1604#discussion_r194162707","pull_request_url":"https://api.github.com/repos/keybase/kbfs/pulls/1604","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/comments/194162707"},"html":{"href":"https://github.com/keybase/kbfs/pull/1604#discussion_r194162707"},"pull_request":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/1604"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/kbfs/pulls/1604","id":193471723,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzNDcxNzIz","html_url":"https://github.com/keybase/kbfs/pull/1604","diff_url":"https://github.com/keybase/kbfs/pull/1604.diff","patch_url":"https://github.com/keybase/kbfs/pull/1604.patch","issue_url":"https://api.github.com/repos/keybase/kbfs/issues/1604","number":1604,"state":"open","locked":false,"title":"fix protocol registration race and cleanup init code","user":{"login":"songgao","id":255797,"node_id":"MDQ6VXNlcjI1NTc5Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/255797?v=4","gravatar_id":"","url":"https://api.github.com/users/songgao","html_url":"https://github.com/songgao","followers_url":"https://api.github.com/users/songgao/followers","following_url":"https://api.github.com/users/songgao/following{/other_user}","gists_url":"https://api.github.com/users/songgao/gists{/gist_id}","starred_url":"https://api.github.com/users/songgao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songgao/subscriptions","organizations_url":"https://api.github.com/users/songgao/orgs","repos_url":"https://api.github.com/users/songgao/repos","events_url":"https://api.github.com/users/songgao/events{/privacy}","received_events_url":"https://api.github.com/users/songgao/received_events","type":"User","site_admin":false},"body":"This would need to go in along with https://github.com/keybase/client/pull/12268\r\n\r\nCircle CI will fail, but I tested an iOS build locally and it works.\r\n\r\n","created_at":"2018-06-07T23:13:43Z","updated_at":"2018-06-08T19:44:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d6002e81886ef820788500157142289f6397b00","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/kbfs/pulls/1604/commits","review_comments_url":"https://api.github.com/repos/keybase/kbfs/pulls/1604/comments","review_comment_url":"https://api.github.com/repos/keybase/kbfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/kbfs/issues/1604/comments","statuses_url":"https://api.github.com/repos/keybase/kbfs/statuses/bd264902ff80a7a1c0390d50bc00c15a18344b02","head":{"label":"keybase:songgao/KBFS-2856","ref":"songgao/KBFS-2856","sha":"bd264902ff80a7a1c0390d50bc00c15a18344b02","user":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":59787605,"node_id":"MDEwOlJlcG9zaXRvcnk1OTc4NzYwNQ==","name":"kbfs","full_name":"keybase/kbfs","owner":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/kbfs","description":"Keybase Filesystem (KBFS)","fork":false,"url":"https://api.github.com/repos/keybase/kbfs","forks_url":"https://api.github.com/repos/keybase/kbfs/forks","keys_url":"https://api.github.com/repos/keybase/kbfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/kbfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/kbfs/teams","hooks_url":"https://api.github.com/repos/keybase/kbfs/hooks","issue_events_url":"https://api.github.com/repos/keybase/kbfs/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/kbfs/events","assignees_url":"https://api.github.com/repos/keybase/kbfs/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/kbfs/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/kbfs/tags","blobs_url":"https://api.github.com/repos/keybase/kbfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/kbfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/kbfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/kbfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/kbfs/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/kbfs/languages","stargazers_url":"https://api.github.com/repos/keybase/kbfs/stargazers","contributors_url":"https://api.github.com/repos/keybase/kbfs/contributors","subscribers_url":"https://api.github.com/repos/keybase/kbfs/subscribers","subscription_url":"https://api.github.com/repos/keybase/kbfs/subscription","commits_url":"https://api.github.com/repos/keybase/kbfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/kbfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/kbfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/kbfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/kbfs/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/kbfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/kbfs/merges","archive_url":"https://api.github.com/repos/keybase/kbfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/kbfs/downloads","issues_url":"https://api.github.com/repos/keybase/kbfs/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/kbfs/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/kbfs/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/kbfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/kbfs/labels{/name}","releases_url":"https://api.github.com/repos/keybase/kbfs/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/kbfs/deployments","created_at":"2016-05-26T22:37:42Z","updated_at":"2018-06-08T19:41:40Z","pushed_at":"2018-06-08T19:43:25Z","git_url":"git://github.com/keybase/kbfs.git","ssh_url":"git@github.com:keybase/kbfs.git","clone_url":"https://github.com/keybase/kbfs.git","svn_url":"https://github.com/keybase/kbfs","homepage":"https://keybase.io/docs/kbfs","size":49904,"stargazers_count":977,"watchers_count":977,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":55,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":90,"open_issues":55,"watchers":977,"default_branch":"master"}},"base":{"label":"keybase:master","ref":"master","sha":"f9dae00f4462a9e611ff47e87afdeca7583c6d90","user":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":59787605,"node_id":"MDEwOlJlcG9zaXRvcnk1OTc4NzYwNQ==","name":"kbfs","full_name":"keybase/kbfs","owner":{"login":"keybase","id":5400834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MDA4MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5400834?v=4","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/kbfs","description":"Keybase Filesystem (KBFS)","fork":false,"url":"https://api.github.com/repos/keybase/kbfs","forks_url":"https://api.github.com/repos/keybase/kbfs/forks","keys_url":"https://api.github.com/repos/keybase/kbfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/kbfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/kbfs/teams","hooks_url":"https://api.github.com/repos/keybase/kbfs/hooks","issue_events_url":"https://api.github.com/repos/keybase/kbfs/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/kbfs/events","assignees_url":"https://api.github.com/repos/keybase/kbfs/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/kbfs/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/kbfs/tags","blobs_url":"https://api.github.com/repos/keybase/kbfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/kbfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/kbfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/kbfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/kbfs/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/kbfs/languages","stargazers_url":"https://api.github.com/repos/keybase/kbfs/stargazers","contributors_url":"https://api.github.com/repos/keybase/kbfs/contributors","subscribers_url":"https://api.github.com/repos/keybase/kbfs/subscribers","subscription_url":"https://api.github.com/repos/keybase/kbfs/subscription","commits_url":"https://api.github.com/repos/keybase/kbfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/kbfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/kbfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/kbfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/kbfs/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/kbfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/kbfs/merges","archive_url":"https://api.github.com/repos/keybase/kbfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/kbfs/downloads","issues_url":"https://api.github.com/repos/keybase/kbfs/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/kbfs/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/kbfs/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/kbfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/kbfs/labels{/name}","releases_url":"https://api.github.com/repos/keybase/kbfs/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/kbfs/deployments","created_at":"2016-05-26T22:37:42Z","updated_at":"2018-06-08T19:41:40Z","pushed_at":"2018-06-08T19:43:25Z","git_url":"git://github.com/keybase/kbfs.git","ssh_url":"git@github.com:keybase/kbfs.git","clone_url":"https://github.com/keybase/kbfs.git","svn_url":"https://github.com/keybase/kbfs","homepage":"https://keybase.io/docs/kbfs","size":49904,"stargazers_count":977,"watchers_count":977,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"archived":false,"open_issues_count":55,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":90,"open_issues":55,"watchers":977,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/1604"},"html":{"href":"https://github.com/keybase/kbfs/pull/1604"},"issue":{"href":"https://api.github.com/repos/keybase/kbfs/issues/1604"},"comments":{"href":"https://api.github.com/repos/keybase/kbfs/issues/1604/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/1604/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/1604/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/kbfs/statuses/bd264902ff80a7a1c0390d50bc00c15a18344b02"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jzila"}}