{"action":"created","issue":{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/921","repository_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin","labels_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/921/labels{/name}","comments_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/921/comments","events_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/921/events","html_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/921","id":172576758,"number":921,"title":"Move us officially over to Next Generation","user":{"login":"andrew-aladev","id":941925,"avatar_url":"https://avatars.githubusercontent.com/u/941925?v=3","gravatar_id":"","url":"https://api.github.com/users/andrew-aladev","html_url":"https://github.com/andrew-aladev","followers_url":"https://api.github.com/users/andrew-aladev/followers","following_url":"https://api.github.com/users/andrew-aladev/following{/other_user}","gists_url":"https://api.github.com/users/andrew-aladev/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-aladev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-aladev/subscriptions","organizations_url":"https://api.github.com/users/andrew-aladev/orgs","repos_url":"https://api.github.com/users/andrew-aladev/repos","events_url":"https://api.github.com/users/andrew-aladev/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-aladev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/labels/3%20-%20Working","name":"3 - Working","color":"CCCCCC"},{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/labels/cla-already-signed","name":"cla-already-signed","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"andrew-aladev","id":941925,"avatar_url":"https://avatars.githubusercontent.com/u/941925?v=3","gravatar_id":"","url":"https://api.github.com/users/andrew-aladev","html_url":"https://github.com/andrew-aladev","followers_url":"https://api.github.com/users/andrew-aladev/followers","following_url":"https://api.github.com/users/andrew-aladev/following{/other_user}","gists_url":"https://api.github.com/users/andrew-aladev/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-aladev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-aladev/subscriptions","organizations_url":"https://api.github.com/users/andrew-aladev/orgs","repos_url":"https://api.github.com/users/andrew-aladev/repos","events_url":"https://api.github.com/users/andrew-aladev/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-aladev/received_events","type":"User","site_admin":false},"assignees":[{"login":"larryonoff","id":372616,"avatar_url":"https://avatars.githubusercontent.com/u/372616?v=3","gravatar_id":"","url":"https://api.github.com/users/larryonoff","html_url":"https://github.com/larryonoff","followers_url":"https://api.github.com/users/larryonoff/followers","following_url":"https://api.github.com/users/larryonoff/following{/other_user}","gists_url":"https://api.github.com/users/larryonoff/gists{/gist_id}","starred_url":"https://api.github.com/users/larryonoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larryonoff/subscriptions","organizations_url":"https://api.github.com/users/larryonoff/orgs","repos_url":"https://api.github.com/users/larryonoff/repos","events_url":"https://api.github.com/users/larryonoff/events{/privacy}","received_events_url":"https://api.github.com/users/larryonoff/received_events","type":"User","site_admin":false},{"login":"andrew-aladev","id":941925,"avatar_url":"https://avatars.githubusercontent.com/u/941925?v=3","gravatar_id":"","url":"https://api.github.com/users/andrew-aladev","html_url":"https://github.com/andrew-aladev","followers_url":"https://api.github.com/users/andrew-aladev/followers","following_url":"https://api.github.com/users/andrew-aladev/following{/other_user}","gists_url":"https://api.github.com/users/andrew-aladev/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-aladev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-aladev/subscriptions","organizations_url":"https://api.github.com/users/andrew-aladev/orgs","repos_url":"https://api.github.com/users/andrew-aladev/repos","events_url":"https://api.github.com/users/andrew-aladev/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-aladev/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/milestones/7","html_url":"https://github.com/thaliproject/Thali_CordovaPlugin/milestones/New%20Infra","labels_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/milestones/7/labels","id":1498038,"number":7,"title":"New Infra","description":"This will be the first release of the new infrastructure working end to end.\r\n\r\n<!---\r\n@huboard:{\"order\":0.25}\r\n-->\r\n","creator":{"login":"yaronyg","id":1480964,"avatar_url":"https://avatars.githubusercontent.com/u/1480964?v=3","gravatar_id":"","url":"https://api.github.com/users/yaronyg","html_url":"https://github.com/yaronyg","followers_url":"https://api.github.com/users/yaronyg/followers","following_url":"https://api.github.com/users/yaronyg/following{/other_user}","gists_url":"https://api.github.com/users/yaronyg/gists{/gist_id}","starred_url":"https://api.github.com/users/yaronyg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaronyg/subscriptions","organizations_url":"https://api.github.com/users/yaronyg/orgs","repos_url":"https://api.github.com/users/yaronyg/repos","events_url":"https://api.github.com/users/yaronyg/events{/privacy}","received_events_url":"https://api.github.com/users/yaronyg/received_events","type":"User","site_admin":false},"open_issues":65,"closed_issues":262,"state":"open","created_at":"2016-01-11T19:12:00Z","updated_at":"2016-08-25T16:26:28Z","due_on":null,"closed_at":null},"comments":16,"created_at":"2016-08-22T23:13:23Z","updated_at":"2016-08-25T17:18:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/921","html_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/921","diff_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/921.diff","patch_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/921.patch"},"body":"Closes #621\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/thaliproject/thali_cordovaplugin/921)\n<!-- Reviewable:end -->\n\r\n\r\n<!---\r\n@huboard:{\"order\":4.4307842838018076e-16,\"milestone_order\":921,\"custom_state\":\"\"}\n-->"},"comment":{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/comments/242470059","html_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/921#issuecomment-242470059","issue_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/921","id":242470059,"user":{"login":"andrew-aladev","id":941925,"avatar_url":"https://avatars.githubusercontent.com/u/941925?v=3","gravatar_id":"","url":"https://api.github.com/users/andrew-aladev","html_url":"https://github.com/andrew-aladev","followers_url":"https://api.github.com/users/andrew-aladev/followers","following_url":"https://api.github.com/users/andrew-aladev/following{/other_user}","gists_url":"https://api.github.com/users/andrew-aladev/gists{/gist_id}","starred_url":"https://api.github.com/users/andrew-aladev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrew-aladev/subscriptions","organizations_url":"https://api.github.com/users/andrew-aladev/orgs","repos_url":"https://api.github.com/users/andrew-aladev/repos","events_url":"https://api.github.com/users/andrew-aladev/events{/privacy}","received_events_url":"https://api.github.com/users/andrew-aladev/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T17:18:14Z","updated_at":"2016-08-25T17:18:14Z","body":"@yaronyg I need some help help. I've found a problem:\r\n\r\n[Here](https://github.com/thaliproject/Thali_CordovaPlugin/blob/vNext_yarong_417_812/thali/NextGeneration/thaliMobile.js#L892) we have:\r\n```\r\nThaliMobileNativeWrapper.emitter.on(\r\n  'nonTCPPeerAvailabilityChangedEvent',\r\n  function (peer) {\r\n    handlePeer(peer, connectionType);\r\n  }\r\n);\r\n\r\nthaliWifiInfrastructure.on(\r\n  'wifiPeerAvailabilityChanged',\r\n  function (peer) {\r\n    handlePeer(peer, connectionTypes.TCP_NATIVE);\r\n  }\r\n);\r\n```\r\n\r\n`handlePeer` does a lookup in it's hash table. Lookup is based on `connectionType` and `peerIdentifier`:\r\n```\r\nvar cachedPeer = peerAvailabilities[peer.connectionType][peer.peerIdentifier];\r\n```\r\nThan `handlePeer` emits the `peerAvailabilityChanged`. So `thaliMobile` will emits same `peer` twice with different `connectionType`.\r\n\r\nBut `ThaliNotificationClient` doesn't like [it](https://github.com/thaliproject/Thali_CordovaPlugin/blob/vNext_yarong_417_812/thali/NextGeneration/notification/thaliNotificationClient.js#L207).\r\n```\r\nassert(!this.peerDictionary.exists(peerStatus.peerIdentifier),\r\n  'peerAvailabilityChanged event with the same peerId'+\r\n  ' should not occur. peerIdentifier:' + peerStatus.peerIdentifier);\r\n```\r\n\r\nWe can change this assert into:\r\n```\r\nassert(\r\n  !(\r\n    this.peerDictionary.exists(peerStatus.peerIdentifier) &&\r\n    this.peerDictionary.get(peerStatus.peerIdentifier)\r\n    .notificationAction._connectionType === peerStatus.connectionType\r\n  ),\r\n  'peerAvailabilityChanged event with the same peerId and ' +\r\n  'connectionType should not occur. ' +\r\n  'peerIdentifier: ' + peerStatus.peerIdentifier + ', ' +\r\n  'connectionType: ' + peerStatus.connectionType\r\n);\r\n```\r\n\r\nBut this doesn't look good.\r\n\r\n1. Maybe we should change `peerDictionary` to works with `dictionary[peer.connectionType][peer.peerIdentifier]` instead of `dictionary[peer.peerIdentifier]`.\r\n2. Maybe we should create special `peerIdentifier` like `peer.connectionType + ':' + peer.peerIdentifier` and use it in `peerDictionary`\r\n2. Maybe we should block `thaliMobile` from emitting same `peer.peerIdentifier` twice."}}
{"actor":{"display_login":"andrew-aladev"}}