{"action":"created","issue":{"url":"https://api.github.com/repos/kadence/kadence/issues/146","repository_url":"https://api.github.com/repos/kadence/kadence","labels_url":"https://api.github.com/repos/kadence/kadence/issues/146/labels{/name}","comments_url":"https://api.github.com/repos/kadence/kadence/issues/146/comments","events_url":"https://api.github.com/repos/kadence/kadence/issues/146/events","html_url":"https://github.com/kadence/kadence/issues/146","id":332289368,"node_id":"MDU6SXNzdWUzMzIyODkzNjg=","number":146,"title":"join event not working like expected","user":{"login":"thEpisode","id":9383114,"node_id":"MDQ6VXNlcjkzODMxMTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9383114?v=4","gravatar_id":"","url":"https://api.github.com/users/thEpisode","html_url":"https://github.com/thEpisode","followers_url":"https://api.github.com/users/thEpisode/followers","following_url":"https://api.github.com/users/thEpisode/following{/other_user}","gists_url":"https://api.github.com/users/thEpisode/gists{/gist_id}","starred_url":"https://api.github.com/users/thEpisode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thEpisode/subscriptions","organizations_url":"https://api.github.com/users/thEpisode/orgs","repos_url":"https://api.github.com/users/thEpisode/repos","events_url":"https://api.github.com/users/thEpisode/events{/privacy}","received_events_url":"https://api.github.com/users/thEpisode/received_events","type":"User","site_admin":false},"labels":[{"id":199668888,"node_id":"MDU6TGFiZWwxOTk2Njg4ODg=","url":"https://api.github.com/repos/kadence/kadence/labels/invalid","name":"invalid","color":"e6e6e6","default":true},{"id":199668890,"node_id":"MDU6TGFiZWwxOTk2Njg4OTA=","url":"https://api.github.com/repos/kadence/kadence/labels/wontfix","name":"wontfix","color":"ffffff","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-14T07:52:36Z","updated_at":"2018-06-14T22:08:01Z","closed_at":"2018-06-14T18:27:54Z","author_association":"NONE","body":"### Package Version\r\n\r\n```\r\n-- @kadenceproject/kadence@3.3.0\r\n```\r\n\r\n### Node Version\r\n```\r\nv8.9.3\r\n```\r\n\r\n### Expected Behavior\r\n\r\nWhen a new node was disconnected from network reduce the peers to real size and notify for disconnection and connected new node.\r\n\r\n\r\n### Actual Behavior\r\n\r\nI have 2 nodes running with quickstart code.\r\n\r\nNode1: \r\n\r\n```javascript\r\nconst kadence = require('@kadenceproject/kadence');\r\nconst levelup = require('levelup');\r\nconst leveldown = require('leveldown');\r\nconst encode = require('encoding-down');\r\n\r\nconst node = new kadence.KademliaNode({\r\n  identity: kadence.utils.getRandomKeyBuffer(),\r\n  transport: new kadence.UDPTransport(),\r\n  storage: levelup(encode(leveldown(`${__dirname}/db`))),\r\n  contact: {\r\n    hostname: 'localhost',\r\n    port: 8080\r\n  }\r\n});\r\n\r\nconst seed = ['0000000000000000000000000000000000000000', { // (sample)\r\n  hostname: 'localhost',\r\n  port: 8080\r\n}];\r\n\r\n\r\n/* node.once('join', function() {\r\n  console.info(`connected to ${node.router.size} peers`);\r\n});\r\n */\r\nnode.once('error', function(err) {\r\n  console.error('failed to join the network', err);\r\n});\r\n\r\nnode.listen(node.contact.port);\r\nnode.join(seed, () => {\r\n  // Add 'join' callback which indicates peers were discovered and\r\n  // our node is now connected to the overlay network\r\n  console.info(`Connected to ${node.router.length} peers!`)\r\n\r\n  // Base protocol exposes:\r\n  // * node.iterativeFindNode(key, callback)\r\n  // * node.iterativeFindValue(key, callback)\r\n  // * node.iterativeStore(key, value, callback)\r\n});\r\n```\r\n\r\nNode2:\r\n\r\n```javascript\r\nconst kadence = require('@kadenceproject/kadence');\r\nconst levelup = require('levelup');\r\nconst leveldown = require('leveldown');\r\nconst encode = require('encoding-down');\r\n\r\nconst node = new kadence.KademliaNode({\r\n  identity: kadence.utils.getRandomKeyBuffer(),\r\n  transport: new kadence.UDPTransport(),\r\n  storage: levelup(encode(leveldown(`${__dirname}/db2`))),\r\n  contact: {\r\n    hostname: 'localhost',\r\n    port: 8081\r\n  }\r\n});\r\n\r\nconst seed = ['0000000000000000000000000000000000000001', { // (sample)\r\n  hostname: 'localhost',\r\n  port: 8080\r\n}];\r\n\r\n\r\nnode.once('join', function() {\r\n  console.info(`connected to ${node.router.size} peers`);\r\n});\r\n\r\nnode.once('error', function(err) {\r\n  console.error('failed to join the network', err);\r\n});\r\n\r\nnode.listen(node.contact.port);\r\nnode.join(seed);\r\n```\r\n\r\n### Steps to Reproduce\r\n\r\n1. run node1\r\n2. run node2\r\n3. stop node2\r\n4. run node2 (see logs on this node and repeat step 3, this show unreal size of network)\r\n"},"comment":{"url":"https://api.github.com/repos/kadence/kadence/issues/comments/397453370","html_url":"https://github.com/kadence/kadence/issues/146#issuecomment-397453370","issue_url":"https://api.github.com/repos/kadence/kadence/issues/146","id":397453370,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzQ1MzM3MA==","user":{"login":"thEpisode","id":9383114,"node_id":"MDQ6VXNlcjkzODMxMTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9383114?v=4","gravatar_id":"","url":"https://api.github.com/users/thEpisode","html_url":"https://github.com/thEpisode","followers_url":"https://api.github.com/users/thEpisode/followers","following_url":"https://api.github.com/users/thEpisode/following{/other_user}","gists_url":"https://api.github.com/users/thEpisode/gists{/gist_id}","starred_url":"https://api.github.com/users/thEpisode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thEpisode/subscriptions","organizations_url":"https://api.github.com/users/thEpisode/orgs","repos_url":"https://api.github.com/users/thEpisode/repos","events_url":"https://api.github.com/users/thEpisode/events{/privacy}","received_events_url":"https://api.github.com/users/thEpisode/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T22:08:01Z","updated_at":"2018-06-14T22:08:01Z","author_association":"NONE","body":"Awesome code, I have only one more question, in certificate files every new node need a new certificate? or is a single certificate for every connected nodes? https://github.com/kadence/kadence/blob/master/bin/config.js#L52 thanks!"}}
{"actor":{"display_login":"thEpisode"}}