{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/etcd/pulls/comments/88137980","pull_request_review_id":8717776,"id":88137980,"diff_hunk":"@@ -21,13 +21,91 @@ import (\n \t\"crypto/rand\"\n \t\"math/big\"\n \t\"strings\"\n+\t\"time\"\n )\n \n const (\n \tletters                  = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n \tdefaultSimpleTokenLength = 16\n+\tsimpleTokenTTL           = 5 * time.Minute\n+\tsimpleTokenTTLResolution = 1 * time.Second\n )\n \n+type simpleTokenTTLKeeper struct {\n+\ttokens              map[string]time.Time\n+\taddSimpleTokenCh    chan string\n+\tresetSimpleTokenCh  chan string\n+\tdeleteSimpleTokenCh chan string\n+\tstopCh              chan chan int\n+\ttokenTicker         *time.Ticker\n+\tdeleteTokenFunc     func(string)\n+}\n+\n+func NewSimpleTokenTTLKeeper(deletefunc func(string)) *simpleTokenTTLKeeper {\n+\tstk := &simpleTokenTTLKeeper{\n+\t\ttokens:              make(map[string]time.Time),\n+\t\taddSimpleTokenCh:    make(chan string, 1),\n+\t\tresetSimpleTokenCh:  make(chan string, 1),\n+\t\tdeleteSimpleTokenCh: make(chan string, 1),\n+\t\tstopCh:              make(chan chan int),\n+\t\tdeleteTokenFunc:     deletefunc,\n+\t}\n+\treturn stk\n+}\n+\n+func (tm *simpleTokenTTLKeeper) start() {\n+\ttm.tokenTicker = time.NewTicker(simpleTokenTTLResolution)\n+\tgo tm.run()\n+}\n+\n+func (tm *simpleTokenTTLKeeper) stop() {\n+\tstoppedCh := make(chan int)\n+\ttm.stopCh <- stoppedCh\n+\t<-stoppedCh\n+\tclose(stoppedCh)\n+\ttm.tokenTicker.Stop()\n+\ttm.tokens = make(map[string]time.Time)\n+}\n+\n+func (tm *simpleTokenTTLKeeper) addSimpleToken(token string) {\n+\ttm.addSimpleTokenCh <- token\n+}\n+\n+func (tm *simpleTokenTTLKeeper) resetSimpleToken(token string) {\n+\ttm.resetSimpleTokenCh <- token\n+}\n+\n+func (tm *simpleTokenTTLKeeper) deleteSimpleToken(token string) {\n+\ttm.deleteSimpleTokenCh <- token\n+}\n+func (tm *simpleTokenTTLKeeper) run() {\n+\tplog.Errorf(\"starting the simple token ttl keeper routine\")","path":"auth/simple_token.go","position":62,"original_position":62,"commit_id":"ef68e53e75b05a5853543a464cea3965d501b03e","original_commit_id":"ef68e53e75b05a5853543a464cea3965d501b03e","user":{"login":"heyitsanthony","id":16294350,"avatar_url":"https://avatars.githubusercontent.com/u/16294350?v=3","gravatar_id":"","url":"https://api.github.com/users/heyitsanthony","html_url":"https://github.com/heyitsanthony","followers_url":"https://api.github.com/users/heyitsanthony/followers","following_url":"https://api.github.com/users/heyitsanthony/following{/other_user}","gists_url":"https://api.github.com/users/heyitsanthony/gists{/gist_id}","starred_url":"https://api.github.com/users/heyitsanthony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heyitsanthony/subscriptions","organizations_url":"https://api.github.com/users/heyitsanthony/orgs","repos_url":"https://api.github.com/users/heyitsanthony/repos","events_url":"https://api.github.com/users/heyitsanthony/events{/privacy}","received_events_url":"https://api.github.com/users/heyitsanthony/received_events","type":"User","site_admin":false},"body":"this shouldn't be errorf since it's part of normal operation, probably debugf","created_at":"2016-11-15T23:27:23Z","updated_at":"2016-11-15T23:27:23Z","html_url":"https://github.com/coreos/etcd/pull/6574#discussion_r88137980","pull_request_url":"https://api.github.com/repos/coreos/etcd/pulls/6574","_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments/88137980"},"html":{"href":"https://github.com/coreos/etcd/pull/6574#discussion_r88137980"},"pull_request":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6574"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/6574","id":87866616,"html_url":"https://github.com/coreos/etcd/pull/6574","diff_url":"https://github.com/coreos/etcd/pull/6574.diff","patch_url":"https://github.com/coreos/etcd/pull/6574.patch","issue_url":"https://api.github.com/repos/coreos/etcd/issues/6574","number":6574,"state":"open","locked":false,"title":"auth/simple_token.go : token not removed when etcdctl session closes …","user":{"login":"vimalk78","id":3284044,"avatar_url":"https://avatars.githubusercontent.com/u/3284044?v=3","gravatar_id":"","url":"https://api.github.com/users/vimalk78","html_url":"https://github.com/vimalk78","followers_url":"https://api.github.com/users/vimalk78/followers","following_url":"https://api.github.com/users/vimalk78/following{/other_user}","gists_url":"https://api.github.com/users/vimalk78/gists{/gist_id}","starred_url":"https://api.github.com/users/vimalk78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vimalk78/subscriptions","organizations_url":"https://api.github.com/users/vimalk78/orgs","repos_url":"https://api.github.com/users/vimalk78/repos","events_url":"https://api.github.com/users/vimalk78/events{/privacy}","received_events_url":"https://api.github.com/users/vimalk78/received_events","type":"User","site_admin":false},"body":"to fix the issue https://github.com/coreos/etcd/issues/6554\n\nWith this solution, everytime a user is Autehticated, the simpleToken map will have max 1 entry fpr every user\n\nFiles modified:\nauth/simpletoken.go : removed any previous token for the same user\n","created_at":"2016-10-04T10:14:22Z","updated_at":"2016-11-15T23:38:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26d0997148a139a8f8b0fcf11e6233526773667d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/coreos/etcd/pulls/6574/commits","review_comments_url":"https://api.github.com/repos/coreos/etcd/pulls/6574/comments","review_comment_url":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/6574/comments","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/ef68e53e75b05a5853543a464cea3965d501b03e","head":{"label":"vimalk78:auth-simpletoken-not-removed#6554","ref":"auth-simpletoken-not-removed#6554","sha":"ef68e53e75b05a5853543a464cea3965d501b03e","user":{"login":"vimalk78","id":3284044,"avatar_url":"https://avatars.githubusercontent.com/u/3284044?v=3","gravatar_id":"","url":"https://api.github.com/users/vimalk78","html_url":"https://github.com/vimalk78","followers_url":"https://api.github.com/users/vimalk78/followers","following_url":"https://api.github.com/users/vimalk78/following{/other_user}","gists_url":"https://api.github.com/users/vimalk78/gists{/gist_id}","starred_url":"https://api.github.com/users/vimalk78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vimalk78/subscriptions","organizations_url":"https://api.github.com/users/vimalk78/orgs","repos_url":"https://api.github.com/users/vimalk78/repos","events_url":"https://api.github.com/users/vimalk78/events{/privacy}","received_events_url":"https://api.github.com/users/vimalk78/received_events","type":"User","site_admin":false},"repo":{"id":65360361,"name":"etcd","full_name":"vimalk78/etcd","owner":{"login":"vimalk78","id":3284044,"avatar_url":"https://avatars.githubusercontent.com/u/3284044?v=3","gravatar_id":"","url":"https://api.github.com/users/vimalk78","html_url":"https://github.com/vimalk78","followers_url":"https://api.github.com/users/vimalk78/followers","following_url":"https://api.github.com/users/vimalk78/following{/other_user}","gists_url":"https://api.github.com/users/vimalk78/gists{/gist_id}","starred_url":"https://api.github.com/users/vimalk78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vimalk78/subscriptions","organizations_url":"https://api.github.com/users/vimalk78/orgs","repos_url":"https://api.github.com/users/vimalk78/repos","events_url":"https://api.github.com/users/vimalk78/events{/privacy}","received_events_url":"https://api.github.com/users/vimalk78/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vimalk78/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":true,"url":"https://api.github.com/repos/vimalk78/etcd","forks_url":"https://api.github.com/repos/vimalk78/etcd/forks","keys_url":"https://api.github.com/repos/vimalk78/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vimalk78/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vimalk78/etcd/teams","hooks_url":"https://api.github.com/repos/vimalk78/etcd/hooks","issue_events_url":"https://api.github.com/repos/vimalk78/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/vimalk78/etcd/events","assignees_url":"https://api.github.com/repos/vimalk78/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/vimalk78/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/vimalk78/etcd/tags","blobs_url":"https://api.github.com/repos/vimalk78/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vimalk78/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vimalk78/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/vimalk78/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vimalk78/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/vimalk78/etcd/languages","stargazers_url":"https://api.github.com/repos/vimalk78/etcd/stargazers","contributors_url":"https://api.github.com/repos/vimalk78/etcd/contributors","subscribers_url":"https://api.github.com/repos/vimalk78/etcd/subscribers","subscription_url":"https://api.github.com/repos/vimalk78/etcd/subscription","commits_url":"https://api.github.com/repos/vimalk78/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/vimalk78/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/vimalk78/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/vimalk78/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/vimalk78/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/vimalk78/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vimalk78/etcd/merges","archive_url":"https://api.github.com/repos/vimalk78/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vimalk78/etcd/downloads","issues_url":"https://api.github.com/repos/vimalk78/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/vimalk78/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/vimalk78/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/vimalk78/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vimalk78/etcd/labels{/name}","releases_url":"https://api.github.com/repos/vimalk78/etcd/releases{/id}","deployments_url":"https://api.github.com/repos/vimalk78/etcd/deployments","created_at":"2016-08-10T07:26:47Z","updated_at":"2016-08-10T07:26:50Z","pushed_at":"2016-11-15T16:28:03Z","git_url":"git://github.com/vimalk78/etcd.git","ssh_url":"git@github.com:vimalk78/etcd.git","clone_url":"https://github.com/vimalk78/etcd.git","svn_url":"https://github.com/vimalk78/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":27360,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"677606da7ddcf030fe48acc64db0c84231e52d7e","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":11225014,"name":"etcd","full_name":"coreos/etcd","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/etcd","description":"Distributed reliable key-value store for the most critical data of a distributed system","fork":false,"url":"https://api.github.com/repos/coreos/etcd","forks_url":"https://api.github.com/repos/coreos/etcd/forks","keys_url":"https://api.github.com/repos/coreos/etcd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/etcd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/etcd/teams","hooks_url":"https://api.github.com/repos/coreos/etcd/hooks","issue_events_url":"https://api.github.com/repos/coreos/etcd/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/etcd/events","assignees_url":"https://api.github.com/repos/coreos/etcd/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/etcd/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/etcd/tags","blobs_url":"https://api.github.com/repos/coreos/etcd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/etcd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/etcd/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/etcd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/etcd/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/etcd/languages","stargazers_url":"https://api.github.com/repos/coreos/etcd/stargazers","contributors_url":"https://api.github.com/repos/coreos/etcd/contributors","subscribers_url":"https://api.github.com/repos/coreos/etcd/subscribers","subscription_url":"https://api.github.com/repos/coreos/etcd/subscription","commits_url":"https://api.github.com/repos/coreos/etcd/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/etcd/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/etcd/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/etcd/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/etcd/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/etcd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/etcd/merges","archive_url":"https://api.github.com/repos/coreos/etcd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/etcd/downloads","issues_url":"https://api.github.com/repos/coreos/etcd/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/etcd/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/etcd/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/etcd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/etcd/labels{/name}","releases_url":"https://api.github.com/repos/coreos/etcd/releases{/id}","deployments_url":"https://api.github.com/repos/coreos/etcd/deployments","created_at":"2013-07-06T21:57:21Z","updated_at":"2016-11-15T15:19:33Z","pushed_at":"2016-11-15T22:37:49Z","git_url":"git://github.com/coreos/etcd.git","ssh_url":"git@github.com:coreos/etcd.git","clone_url":"https://github.com/coreos/etcd.git","svn_url":"https://github.com/coreos/etcd","homepage":"https://coreos.com/etcd/docs/latest/","size":35594,"stargazers_count":11416,"watchers_count":11416,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2044,"mirror_url":null,"open_issues_count":101,"forks":2044,"open_issues":101,"watchers":11416,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6574"},"html":{"href":"https://github.com/coreos/etcd/pull/6574"},"issue":{"href":"https://api.github.com/repos/coreos/etcd/issues/6574"},"comments":{"href":"https://api.github.com/repos/coreos/etcd/issues/6574/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6574/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/etcd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/etcd/pulls/6574/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/etcd/statuses/ef68e53e75b05a5853543a464cea3965d501b03e"}}}}
{"actor":{"display_login":"heyitsanthony"}}