{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1035","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1035/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1035/comments","events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1035/events","html_url":"https://github.com/ethereum/go-ethereum/pull/1035","id":77759457,"number":1035,"title":"eth: make the peer-set thread safe","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},"labels":[{"url":"https://api.github.com/repos/ethereum/go-ethereum/labels/review","name":"review","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-18T18:39:06Z","updated_at":"2015-05-20T07:35:46Z","closed_at":"2015-05-19T15:50:38Z","pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1035","html_url":"https://github.com/ethereum/go-ethereum/pull/1035","diff_url":"https://github.com/ethereum/go-ethereum/pull/1035.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/1035.patch"},"body":"I've separated the peer-set into its own struct, with an embedded lock and also the required helper methods moved into it (finding peers with missing blocks/txns, best peer, etc).\r\n\r\nI've also added some further logging, among others 2 error level logs in case a peer is added/removed twice. This should help discover data races or some weird usage scenarios leading to corrupted peer sets and inherently those pesky \"unhealthy\" peer messages.\r\n\r\nAlso, until now during transaction and block broadcast, the peer map mutex was write locked, meaning that while a broadcast was pending, everything else had to wait. I've reworked this to a) use read only locks, b) release as soon as the list of needed peers is assembled, no need to wait for the send to complete."},"comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments/103795448","html_url":"https://github.com/ethereum/go-ethereum/pull/1035#issuecomment-103795448","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1035","id":103795448,"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},"created_at":"2015-05-20T07:35:46Z","updated_at":"2015-05-20T07:35:46Z","body":"PTAL https://github.com/ethereum/go-ethereum/pull/1051"}}