{"action":"created","comment":{"url":"https://api.github.com/repos/status-im/status-go/pulls/comments/173062339","pull_request_review_id":102183721,"id":173062339,"diff_hunk":"@@ -16,52 +18,130 @@ import (\n const (\n \t// defaultWorkTime is a work time reported in messages sent to MailServer nodes.\n \tdefaultWorkTime = 5\n+\n+\t// gcTimeout defines timeout to release not used connection with mailserver peers.\n+\tgcTimeout = 5 * time.Minute\n+\t// gcPeriod defines how often to run garbage collector.\n+\tgcPeriod = 3 * time.Second\n+\n+\t// peerConnectTimeout defines timeout to connect with a peer.\n+\tpeerConnectTimeout = 10 * time.Second\n )\n \n var (\n \t// ErrInvalidMailServerPeer is returned when it fails to parse enode from params.\n \tErrInvalidMailServerPeer = errors.New(\"invalid mailServerPeer value\")\n \t// ErrInvalidSymKeyID is returned when it fails to get a symmetric key.\n \tErrInvalidSymKeyID = errors.New(\"invalid symKeyID value\")\n+\t// ErrNoServersInConfig is returned when no trusted peers are configured for p2p.Server\n+\tErrNoServersInConfig = errors.New(\"no mailservers are available\")\n )\n \n // PublicAPI defines a MailServer public API.\n type PublicAPI struct {\n-\tprovider ServiceProvider\n+\tservice *MailService\n+\n+\tnewConnectedPeers chan *discover.Node","path":"geth/mailservice/mailservice_api.go","position":39,"original_position":39,"commit_id":"b407990303906357416a9aa6d506ebc092a919ff","original_commit_id":"b407990303906357416a9aa6d506ebc092a919ff","user":{"login":"adambabik","id":277870,"avatar_url":"https://avatars1.githubusercontent.com/u/277870?v=4","gravatar_id":"","url":"https://api.github.com/users/adambabik","html_url":"https://github.com/adambabik","followers_url":"https://api.github.com/users/adambabik/followers","following_url":"https://api.github.com/users/adambabik/following{/other_user}","gists_url":"https://api.github.com/users/adambabik/gists{/gist_id}","starred_url":"https://api.github.com/users/adambabik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambabik/subscriptions","organizations_url":"https://api.github.com/users/adambabik/orgs","repos_url":"https://api.github.com/users/adambabik/repos","events_url":"https://api.github.com/users/adambabik/events{/privacy}","received_events_url":"https://api.github.com/users/adambabik/received_events","type":"User","site_admin":false},"body":"Maybe we can call it `selectedPeers` as it is usually used after `api.choosePeer()`? ","created_at":"2018-03-08T04:38:06Z","updated_at":"2018-03-08T04:51:57Z","html_url":"https://github.com/status-im/status-go/pull/700#discussion_r173062339","pull_request_url":"https://api.github.com/repos/status-im/status-go/pulls/700","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/status-im/status-go/pulls/comments/173062339"},"html":{"href":"https://github.com/status-im/status-go/pull/700#discussion_r173062339"},"pull_request":{"href":"https://api.github.com/repos/status-im/status-go/pulls/700"}}},"pull_request":{"url":"https://api.github.com/repos/status-im/status-go/pulls/700","id":171056601,"html_url":"https://github.com/status-im/status-go/pull/700","diff_url":"https://github.com/status-im/status-go/pull/700.diff","patch_url":"https://github.com/status-im/status-go/pull/700.patch","issue_url":"https://api.github.com/repos/status-im/status-go/issues/700","number":700,"state":"open","locked":false,"title":"Handle mail servers on the side of status-go","user":{"login":"dshulyak","id":1964576,"avatar_url":"https://avatars2.githubusercontent.com/u/1964576?v=4","gravatar_id":"","url":"https://api.github.com/users/dshulyak","html_url":"https://github.com/dshulyak","followers_url":"https://api.github.com/users/dshulyak/followers","following_url":"https://api.github.com/users/dshulyak/following{/other_user}","gists_url":"https://api.github.com/users/dshulyak/gists{/gist_id}","starred_url":"https://api.github.com/users/dshulyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dshulyak/subscriptions","organizations_url":"https://api.github.com/users/dshulyak/orgs","repos_url":"https://api.github.com/users/dshulyak/repos","events_url":"https://api.github.com/users/dshulyak/events{/privacy}","received_events_url":"https://api.github.com/users/dshulyak/received_events","type":"User","site_admin":false},"body":"This primary goal of this change is to allow setting a limit of static peers with `MaxPeers` and at the same time allow connections to trusted peers (like MailServers). A total number of allowed peers will equal `MaxPeers + len(trustedPeers)`.\r\n\r\nTo make it possible we have to move mailserver from being defined in status-react to cht.json config.\r\nWhen request historic messages are received we will check if we have any mail server connected to our node and if not - we will use the first one from config (will be changed to random). Additionally, we will wait till mail server is connected. After a period of time (5m) we will release connection to mail server so that other peers can use it.\r\n\r\nAlso, I changed one e2e test to connect with mail server through a proxy node, to cover both cases when a node is connected/not connected at the time of request historic messages. And connection garbage collector tested separately in the unit test.\r\n","created_at":"2018-02-23T16:23:29Z","updated_at":"2018-03-08T04:51:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c8c1a81d5d4f5a9349ae3b69702ade63cc9115d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":668401138,"url":"https://api.github.com/repos/status-im/status-go/labels/blocked","name":"blocked","color":"b60205","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/status-im/status-go/pulls/700/commits","review_comments_url":"https://api.github.com/repos/status-im/status-go/pulls/700/comments","review_comment_url":"https://api.github.com/repos/status-im/status-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/status-im/status-go/issues/700/comments","statuses_url":"https://api.github.com/repos/status-im/status-go/statuses/b407990303906357416a9aa6d506ebc092a919ff","head":{"label":"dshulyak:add_trusted","ref":"add_trusted","sha":"b407990303906357416a9aa6d506ebc092a919ff","user":{"login":"dshulyak","id":1964576,"avatar_url":"https://avatars2.githubusercontent.com/u/1964576?v=4","gravatar_id":"","url":"https://api.github.com/users/dshulyak","html_url":"https://github.com/dshulyak","followers_url":"https://api.github.com/users/dshulyak/followers","following_url":"https://api.github.com/users/dshulyak/following{/other_user}","gists_url":"https://api.github.com/users/dshulyak/gists{/gist_id}","starred_url":"https://api.github.com/users/dshulyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dshulyak/subscriptions","organizations_url":"https://api.github.com/users/dshulyak/orgs","repos_url":"https://api.github.com/users/dshulyak/repos","events_url":"https://api.github.com/users/dshulyak/events{/privacy}","received_events_url":"https://api.github.com/users/dshulyak/received_events","type":"User","site_admin":false},"repo":{"id":115918431,"name":"status-go","full_name":"dshulyak/status-go","owner":{"login":"dshulyak","id":1964576,"avatar_url":"https://avatars2.githubusercontent.com/u/1964576?v=4","gravatar_id":"","url":"https://api.github.com/users/dshulyak","html_url":"https://github.com/dshulyak","followers_url":"https://api.github.com/users/dshulyak/followers","following_url":"https://api.github.com/users/dshulyak/following{/other_user}","gists_url":"https://api.github.com/users/dshulyak/gists{/gist_id}","starred_url":"https://api.github.com/users/dshulyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dshulyak/subscriptions","organizations_url":"https://api.github.com/users/dshulyak/orgs","repos_url":"https://api.github.com/users/dshulyak/repos","events_url":"https://api.github.com/users/dshulyak/events{/privacy}","received_events_url":"https://api.github.com/users/dshulyak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dshulyak/status-go","description":"The Status module that consumes go-ethereum","fork":true,"url":"https://api.github.com/repos/dshulyak/status-go","forks_url":"https://api.github.com/repos/dshulyak/status-go/forks","keys_url":"https://api.github.com/repos/dshulyak/status-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dshulyak/status-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dshulyak/status-go/teams","hooks_url":"https://api.github.com/repos/dshulyak/status-go/hooks","issue_events_url":"https://api.github.com/repos/dshulyak/status-go/issues/events{/number}","events_url":"https://api.github.com/repos/dshulyak/status-go/events","assignees_url":"https://api.github.com/repos/dshulyak/status-go/assignees{/user}","branches_url":"https://api.github.com/repos/dshulyak/status-go/branches{/branch}","tags_url":"https://api.github.com/repos/dshulyak/status-go/tags","blobs_url":"https://api.github.com/repos/dshulyak/status-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dshulyak/status-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dshulyak/status-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/dshulyak/status-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dshulyak/status-go/statuses/{sha}","languages_url":"https://api.github.com/repos/dshulyak/status-go/languages","stargazers_url":"https://api.github.com/repos/dshulyak/status-go/stargazers","contributors_url":"https://api.github.com/repos/dshulyak/status-go/contributors","subscribers_url":"https://api.github.com/repos/dshulyak/status-go/subscribers","subscription_url":"https://api.github.com/repos/dshulyak/status-go/subscription","commits_url":"https://api.github.com/repos/dshulyak/status-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/dshulyak/status-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/dshulyak/status-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/dshulyak/status-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/dshulyak/status-go/contents/{+path}","compare_url":"https://api.github.com/repos/dshulyak/status-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dshulyak/status-go/merges","archive_url":"https://api.github.com/repos/dshulyak/status-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dshulyak/status-go/downloads","issues_url":"https://api.github.com/repos/dshulyak/status-go/issues{/number}","pulls_url":"https://api.github.com/repos/dshulyak/status-go/pulls{/number}","milestones_url":"https://api.github.com/repos/dshulyak/status-go/milestones{/number}","notifications_url":"https://api.github.com/repos/dshulyak/status-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dshulyak/status-go/labels{/name}","releases_url":"https://api.github.com/repos/dshulyak/status-go/releases{/id}","deployments_url":"https://api.github.com/repos/dshulyak/status-go/deployments","created_at":"2018-01-01T12:40:30Z","updated_at":"2018-01-01T12:40:32Z","pushed_at":"2018-02-28T13:51:56Z","git_url":"git://github.com/dshulyak/status-go.git","ssh_url":"git@github.com:dshulyak/status-go.git","clone_url":"https://github.com/dshulyak/status-go.git","svn_url":"https://github.com/dshulyak/status-go","homepage":"https://status.im","size":39069,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"status-im:develop","ref":"develop","sha":"f7baca7835497fdf6a1ac9dae97da4e2e16b1ca3","user":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"repo":{"id":61047867,"name":"status-go","full_name":"status-im/status-go","owner":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/status-im/status-go","description":"The Status module that consumes go-ethereum","fork":false,"url":"https://api.github.com/repos/status-im/status-go","forks_url":"https://api.github.com/repos/status-im/status-go/forks","keys_url":"https://api.github.com/repos/status-im/status-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/status-im/status-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/status-im/status-go/teams","hooks_url":"https://api.github.com/repos/status-im/status-go/hooks","issue_events_url":"https://api.github.com/repos/status-im/status-go/issues/events{/number}","events_url":"https://api.github.com/repos/status-im/status-go/events","assignees_url":"https://api.github.com/repos/status-im/status-go/assignees{/user}","branches_url":"https://api.github.com/repos/status-im/status-go/branches{/branch}","tags_url":"https://api.github.com/repos/status-im/status-go/tags","blobs_url":"https://api.github.com/repos/status-im/status-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/status-im/status-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/status-im/status-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/status-im/status-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/status-im/status-go/statuses/{sha}","languages_url":"https://api.github.com/repos/status-im/status-go/languages","stargazers_url":"https://api.github.com/repos/status-im/status-go/stargazers","contributors_url":"https://api.github.com/repos/status-im/status-go/contributors","subscribers_url":"https://api.github.com/repos/status-im/status-go/subscribers","subscription_url":"https://api.github.com/repos/status-im/status-go/subscription","commits_url":"https://api.github.com/repos/status-im/status-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/status-im/status-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/status-im/status-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/status-im/status-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/status-im/status-go/contents/{+path}","compare_url":"https://api.github.com/repos/status-im/status-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/status-im/status-go/merges","archive_url":"https://api.github.com/repos/status-im/status-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/status-im/status-go/downloads","issues_url":"https://api.github.com/repos/status-im/status-go/issues{/number}","pulls_url":"https://api.github.com/repos/status-im/status-go/pulls{/number}","milestones_url":"https://api.github.com/repos/status-im/status-go/milestones{/number}","notifications_url":"https://api.github.com/repos/status-im/status-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/status-im/status-go/labels{/name}","releases_url":"https://api.github.com/repos/status-im/status-go/releases{/id}","deployments_url":"https://api.github.com/repos/status-im/status-go/deployments","created_at":"2016-06-13T15:32:03Z","updated_at":"2018-03-07T22:51:47Z","pushed_at":"2018-03-06T22:15:39Z","git_url":"git://github.com/status-im/status-go.git","ssh_url":"git@github.com:status-im/status-go.git","clone_url":"https://github.com/status-im/status-go.git","svn_url":"https://github.com/status-im/status-go","homepage":"https://status.im","size":37199,"stargazers_count":344,"watchers_count":344,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":106,"mirror_url":null,"archived":false,"open_issues_count":64,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":106,"open_issues":64,"watchers":344,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/status-im/status-go/pulls/700"},"html":{"href":"https://github.com/status-im/status-go/pull/700"},"issue":{"href":"https://api.github.com/repos/status-im/status-go/issues/700"},"comments":{"href":"https://api.github.com/repos/status-im/status-go/issues/700/comments"},"review_comments":{"href":"https://api.github.com/repos/status-im/status-go/pulls/700/comments"},"review_comment":{"href":"https://api.github.com/repos/status-im/status-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/status-im/status-go/pulls/700/commits"},"statuses":{"href":"https://api.github.com/repos/status-im/status-go/statuses/b407990303906357416a9aa6d506ebc092a919ff"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"adambabik"}}