{"action":"created","issue":{"url":"https://api.github.com/repos/btcsuite/btcd/issues/561","labels_url":"https://api.github.com/repos/btcsuite/btcd/issues/561/labels{/name}","comments_url":"https://api.github.com/repos/btcsuite/btcd/issues/561/comments","events_url":"https://api.github.com/repos/btcsuite/btcd/issues/561/events","html_url":"https://github.com/btcsuite/btcd/pull/561","id":118254601,"number":561,"title":"server: Improve handling of disconnected peers.","user":{"login":"davecgh","id":2115102,"avatar_url":"https://avatars.githubusercontent.com/u/2115102?v=3","gravatar_id":"","url":"https://api.github.com/users/davecgh","html_url":"https://github.com/davecgh","followers_url":"https://api.github.com/users/davecgh/followers","following_url":"https://api.github.com/users/davecgh/following{/other_user}","gists_url":"https://api.github.com/users/davecgh/gists{/gist_id}","starred_url":"https://api.github.com/users/davecgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davecgh/subscriptions","organizations_url":"https://api.github.com/users/davecgh/orgs","repos_url":"https://api.github.com/users/davecgh/repos","events_url":"https://api.github.com/users/davecgh/events{/privacy}","received_events_url":"https://api.github.com/users/davecgh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-22T10:14:28Z","updated_at":"2015-11-23T15:57:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/btcsuite/btcd/pulls/561","html_url":"https://github.com/btcsuite/btcd/pull/561","diff_url":"https://github.com/btcsuite/btcd/pull/561.diff","patch_url":"https://github.com/btcsuite/btcd/pull/561.patch"},"body":"When the peer code was refactored, the lists of peers were converted to maps however the code which runs when a peer disconnects still iterates them like a slice.  This is no longer necessary since they are maps\r\nwhich means the peer can simply be looked up by its ID.\r\n\r\nAlso, the old code was comparing the map entry and the peer being removed by their pointers which could lead to potentially not properly finding the peer.  This issue is also resolved by this change since it looks up the peer by its ID.\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/btcsuite/btcd/561)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/btcsuite/btcd/issues/comments/158978131","html_url":"https://github.com/btcsuite/btcd/pull/561#issuecomment-158978131","issue_url":"https://api.github.com/repos/btcsuite/btcd/issues/561","id":158978131,"user":{"login":"dajohi","id":3308193,"avatar_url":"https://avatars.githubusercontent.com/u/3308193?v=3","gravatar_id":"","url":"https://api.github.com/users/dajohi","html_url":"https://github.com/dajohi","followers_url":"https://api.github.com/users/dajohi/followers","following_url":"https://api.github.com/users/dajohi/following{/other_user}","gists_url":"https://api.github.com/users/dajohi/gists{/gist_id}","starred_url":"https://api.github.com/users/dajohi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dajohi/subscriptions","organizations_url":"https://api.github.com/users/dajohi/orgs","repos_url":"https://api.github.com/users/dajohi/repos","events_url":"https://api.github.com/users/dajohi/events{/privacy}","received_events_url":"https://api.github.com/users/dajohi/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T15:57:30Z","updated_at":"2015-11-23T15:57:30Z","body":"OK, nice catch."}}