{"action":"created","comment":{"url":"https://api.github.com/repos/multiformats/js-multistream/pulls/comments/77454829","id":77454829,"diff_hunk":"@@ -5,66 +5,77 @@ const varint = require('varint')\n const pull = require('pull-stream')\n const Connection = require('interface-connection').Connection\n const debug = require('debug')\n-const log = debug('libp2p:multistream:dialer')\n+const log = debug('multistream:dialer')\n \n-const PROTOCOL_ID = require('./protocol-id')\n-const agreement = require('./agreement')\n+const PROTOCOL_ID = require('./constants').PROTOCOL_ID\n+const agrmt = require('./agreement')\n \n module.exports = class Dialer {\n   constructor () {\n     this.conn = null\n   }\n \n   // perform the multistream handshake\n-  handle (rawConn, cb) {\n+  handle (rawConn, callback) {\n     log('handling connection')\n-    const ms = agreement.dial(PROTOCOL_ID, (err, conn) => {\n+    const ms = agrmt.select(PROTOCOL_ID, (err, conn) => {\n       if (err) {\n-        return cb(err)\n+        return callback(err)\n       }\n       log('handshake success')\n \n       this.conn = new Connection(conn, rawConn)\n \n-      cb()\n+      callback()\n     })\n     pull(rawConn, ms, rawConn)\n   }\n \n-  select (protocol, cb) {\n-    log('selecting %s', protocol)\n+  select (protocol, callback) {\n+    log('dialer select %s', protocol)\n     if (!this.conn) {\n-      return cb(new Error('multistream handshake has not finalized yet'))\n+      return callback(new Error('multistream handshake has not finalized yet'))\n     }\n \n-    const stream = agreement.dial(protocol, (err, conn) => {\n+    const selectStream = agrmt.select(protocol, (err, conn) => {\n       if (err) {\n-        return cb(err)\n+        return callback(err)\n       }\n-      // TODO: handle 'na'\n-      cb(null, new Connection(conn, this.conn))\n+      callback(null, new Connection(conn, this.conn))\n     })\n \n-    pull(this.conn, stream, this.conn)\n+    pull(\n+      this.conn,\n+      selectStream,\n+      this.conn\n+    )","path":"src/dialer.js","position":62,"original_position":62,"commit_id":"f59b7eb34a3d58fe5207b85781a736989efc2701","original_commit_id":"f59b7eb34a3d58fe5207b85781a736989efc2701","user":{"login":"dignifiedquire","id":790842,"avatar_url":"https://avatars.githubusercontent.com/u/790842?v=3","gravatar_id":"","url":"https://api.github.com/users/dignifiedquire","html_url":"https://github.com/dignifiedquire","followers_url":"https://api.github.com/users/dignifiedquire/followers","following_url":"https://api.github.com/users/dignifiedquire/following{/other_user}","gists_url":"https://api.github.com/users/dignifiedquire/gists{/gist_id}","starred_url":"https://api.github.com/users/dignifiedquire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dignifiedquire/subscriptions","organizations_url":"https://api.github.com/users/dignifiedquire/orgs","repos_url":"https://api.github.com/users/dignifiedquire/repos","events_url":"https://api.github.com/users/dignifiedquire/events{/privacy}","received_events_url":"https://api.github.com/users/dignifiedquire/received_events","type":"User","site_admin":false},"body":"why you change these all around? ","created_at":"2016-09-04T16:01:29Z","updated_at":"2016-09-04T16:01:29Z","html_url":"https://github.com/multiformats/js-multistream/pull/21#discussion_r77454829","pull_request_url":"https://api.github.com/repos/multiformats/js-multistream/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/multiformats/js-multistream/pulls/comments/77454829"},"html":{"href":"https://github.com/multiformats/js-multistream/pull/21#discussion_r77454829"},"pull_request":{"href":"https://api.github.com/repos/multiformats/js-multistream/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/multiformats/js-multistream/pulls/21","id":83925908,"html_url":"https://github.com/multiformats/js-multistream/pull/21","diff_url":"https://github.com/multiformats/js-multistream/pull/21.diff","patch_url":"https://github.com/multiformats/js-multistream/pull/21.patch","issue_url":"https://api.github.com/repos/multiformats/js-multistream/issues/21","number":21,"state":"open","locked":false,"title":"Don't assume that the dialer side is going to write first","user":{"login":"diasdavid","id":1211152,"avatar_url":"https://avatars.githubusercontent.com/u/1211152?v=3","gravatar_id":"","url":"https://api.github.com/users/diasdavid","html_url":"https://github.com/diasdavid","followers_url":"https://api.github.com/users/diasdavid/followers","following_url":"https://api.github.com/users/diasdavid/following{/other_user}","gists_url":"https://api.github.com/users/diasdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/diasdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diasdavid/subscriptions","organizations_url":"https://api.github.com/users/diasdavid/orgs","repos_url":"https://api.github.com/users/diasdavid/repos","events_url":"https://api.github.com/users/diasdavid/events{/privacy}","received_events_url":"https://api.github.com/users/diasdavid/received_events","type":"User","site_admin":false},"body":"The listener was waiting for `multistream` multicodec in order to send it back. go-ipfs expects it to be sent right away (or go-ipfs doesn't really send it until it has more to write)","created_at":"2016-09-04T15:31:43Z","updated_at":"2016-09-04T16:01:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ddfb3e3e08cb1d2bc4ebb52c57d9ed49e194ea4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/multiformats/js-multistream/pulls/21/commits","review_comments_url":"https://api.github.com/repos/multiformats/js-multistream/pulls/21/comments","review_comment_url":"https://api.github.com/repos/multiformats/js-multistream/pulls/comments{/number}","comments_url":"https://api.github.com/repos/multiformats/js-multistream/issues/21/comments","statuses_url":"https://api.github.com/repos/multiformats/js-multistream/statuses/f59b7eb34a3d58fe5207b85781a736989efc2701","head":{"label":"multiformats:pull-fix","ref":"pull-fix","sha":"f59b7eb34a3d58fe5207b85781a736989efc2701","user":{"login":"multiformats","id":20296538,"avatar_url":"https://avatars.githubusercontent.com/u/20296538?v=3","gravatar_id":"","url":"https://api.github.com/users/multiformats","html_url":"https://github.com/multiformats","followers_url":"https://api.github.com/users/multiformats/followers","following_url":"https://api.github.com/users/multiformats/following{/other_user}","gists_url":"https://api.github.com/users/multiformats/gists{/gist_id}","starred_url":"https://api.github.com/users/multiformats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multiformats/subscriptions","organizations_url":"https://api.github.com/users/multiformats/orgs","repos_url":"https://api.github.com/users/multiformats/repos","events_url":"https://api.github.com/users/multiformats/events{/privacy}","received_events_url":"https://api.github.com/users/multiformats/received_events","type":"Organization","site_admin":false},"repo":{"id":37012649,"name":"js-multistream","full_name":"multiformats/js-multistream","owner":{"login":"multiformats","id":20296538,"avatar_url":"https://avatars.githubusercontent.com/u/20296538?v=3","gravatar_id":"","url":"https://api.github.com/users/multiformats","html_url":"https://github.com/multiformats","followers_url":"https://api.github.com/users/multiformats/followers","following_url":"https://api.github.com/users/multiformats/following{/other_user}","gists_url":"https://api.github.com/users/multiformats/gists{/gist_id}","starred_url":"https://api.github.com/users/multiformats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multiformats/subscriptions","organizations_url":"https://api.github.com/users/multiformats/orgs","repos_url":"https://api.github.com/users/multiformats/repos","events_url":"https://api.github.com/users/multiformats/events{/privacy}","received_events_url":"https://api.github.com/users/multiformats/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/multiformats/js-multistream","description":"JavaScript implementation of multistream","fork":false,"url":"https://api.github.com/repos/multiformats/js-multistream","forks_url":"https://api.github.com/repos/multiformats/js-multistream/forks","keys_url":"https://api.github.com/repos/multiformats/js-multistream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/multiformats/js-multistream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/multiformats/js-multistream/teams","hooks_url":"https://api.github.com/repos/multiformats/js-multistream/hooks","issue_events_url":"https://api.github.com/repos/multiformats/js-multistream/issues/events{/number}","events_url":"https://api.github.com/repos/multiformats/js-multistream/events","assignees_url":"https://api.github.com/repos/multiformats/js-multistream/assignees{/user}","branches_url":"https://api.github.com/repos/multiformats/js-multistream/branches{/branch}","tags_url":"https://api.github.com/repos/multiformats/js-multistream/tags","blobs_url":"https://api.github.com/repos/multiformats/js-multistream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/multiformats/js-multistream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/multiformats/js-multistream/git/refs{/sha}","trees_url":"https://api.github.com/repos/multiformats/js-multistream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/multiformats/js-multistream/statuses/{sha}","languages_url":"https://api.github.com/repos/multiformats/js-multistream/languages","stargazers_url":"https://api.github.com/repos/multiformats/js-multistream/stargazers","contributors_url":"https://api.github.com/repos/multiformats/js-multistream/contributors","subscribers_url":"https://api.github.com/repos/multiformats/js-multistream/subscribers","subscription_url":"https://api.github.com/repos/multiformats/js-multistream/subscription","commits_url":"https://api.github.com/repos/multiformats/js-multistream/commits{/sha}","git_commits_url":"https://api.github.com/repos/multiformats/js-multistream/git/commits{/sha}","comments_url":"https://api.github.com/repos/multiformats/js-multistream/comments{/number}","issue_comment_url":"https://api.github.com/repos/multiformats/js-multistream/issues/comments{/number}","contents_url":"https://api.github.com/repos/multiformats/js-multistream/contents/{+path}","compare_url":"https://api.github.com/repos/multiformats/js-multistream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/multiformats/js-multistream/merges","archive_url":"https://api.github.com/repos/multiformats/js-multistream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/multiformats/js-multistream/downloads","issues_url":"https://api.github.com/repos/multiformats/js-multistream/issues{/number}","pulls_url":"https://api.github.com/repos/multiformats/js-multistream/pulls{/number}","milestones_url":"https://api.github.com/repos/multiformats/js-multistream/milestones{/number}","notifications_url":"https://api.github.com/repos/multiformats/js-multistream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/multiformats/js-multistream/labels{/name}","releases_url":"https://api.github.com/repos/multiformats/js-multistream/releases{/id}","deployments_url":"https://api.github.com/repos/multiformats/js-multistream/deployments","created_at":"2015-06-07T10:34:47Z","updated_at":"2016-08-15T20:44:52Z","pushed_at":"2016-09-04T15:34:30Z","git_url":"git://github.com/multiformats/js-multistream.git","ssh_url":"git@github.com:multiformats/js-multistream.git","clone_url":"https://github.com/multiformats/js-multistream.git","svn_url":"https://github.com/multiformats/js-multistream","homepage":"https://github.com/multiformats/multistream","size":3075,"stargazers_count":12,"watchers_count":12,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":12,"default_branch":"master"}},"base":{"label":"multiformats:pull","ref":"pull","sha":"440780c0cbeaee7bb3da64e2c49a9854147e2f0c","user":{"login":"multiformats","id":20296538,"avatar_url":"https://avatars.githubusercontent.com/u/20296538?v=3","gravatar_id":"","url":"https://api.github.com/users/multiformats","html_url":"https://github.com/multiformats","followers_url":"https://api.github.com/users/multiformats/followers","following_url":"https://api.github.com/users/multiformats/following{/other_user}","gists_url":"https://api.github.com/users/multiformats/gists{/gist_id}","starred_url":"https://api.github.com/users/multiformats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multiformats/subscriptions","organizations_url":"https://api.github.com/users/multiformats/orgs","repos_url":"https://api.github.com/users/multiformats/repos","events_url":"https://api.github.com/users/multiformats/events{/privacy}","received_events_url":"https://api.github.com/users/multiformats/received_events","type":"Organization","site_admin":false},"repo":{"id":37012649,"name":"js-multistream","full_name":"multiformats/js-multistream","owner":{"login":"multiformats","id":20296538,"avatar_url":"https://avatars.githubusercontent.com/u/20296538?v=3","gravatar_id":"","url":"https://api.github.com/users/multiformats","html_url":"https://github.com/multiformats","followers_url":"https://api.github.com/users/multiformats/followers","following_url":"https://api.github.com/users/multiformats/following{/other_user}","gists_url":"https://api.github.com/users/multiformats/gists{/gist_id}","starred_url":"https://api.github.com/users/multiformats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multiformats/subscriptions","organizations_url":"https://api.github.com/users/multiformats/orgs","repos_url":"https://api.github.com/users/multiformats/repos","events_url":"https://api.github.com/users/multiformats/events{/privacy}","received_events_url":"https://api.github.com/users/multiformats/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/multiformats/js-multistream","description":"JavaScript implementation of multistream","fork":false,"url":"https://api.github.com/repos/multiformats/js-multistream","forks_url":"https://api.github.com/repos/multiformats/js-multistream/forks","keys_url":"https://api.github.com/repos/multiformats/js-multistream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/multiformats/js-multistream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/multiformats/js-multistream/teams","hooks_url":"https://api.github.com/repos/multiformats/js-multistream/hooks","issue_events_url":"https://api.github.com/repos/multiformats/js-multistream/issues/events{/number}","events_url":"https://api.github.com/repos/multiformats/js-multistream/events","assignees_url":"https://api.github.com/repos/multiformats/js-multistream/assignees{/user}","branches_url":"https://api.github.com/repos/multiformats/js-multistream/branches{/branch}","tags_url":"https://api.github.com/repos/multiformats/js-multistream/tags","blobs_url":"https://api.github.com/repos/multiformats/js-multistream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/multiformats/js-multistream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/multiformats/js-multistream/git/refs{/sha}","trees_url":"https://api.github.com/repos/multiformats/js-multistream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/multiformats/js-multistream/statuses/{sha}","languages_url":"https://api.github.com/repos/multiformats/js-multistream/languages","stargazers_url":"https://api.github.com/repos/multiformats/js-multistream/stargazers","contributors_url":"https://api.github.com/repos/multiformats/js-multistream/contributors","subscribers_url":"https://api.github.com/repos/multiformats/js-multistream/subscribers","subscription_url":"https://api.github.com/repos/multiformats/js-multistream/subscription","commits_url":"https://api.github.com/repos/multiformats/js-multistream/commits{/sha}","git_commits_url":"https://api.github.com/repos/multiformats/js-multistream/git/commits{/sha}","comments_url":"https://api.github.com/repos/multiformats/js-multistream/comments{/number}","issue_comment_url":"https://api.github.com/repos/multiformats/js-multistream/issues/comments{/number}","contents_url":"https://api.github.com/repos/multiformats/js-multistream/contents/{+path}","compare_url":"https://api.github.com/repos/multiformats/js-multistream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/multiformats/js-multistream/merges","archive_url":"https://api.github.com/repos/multiformats/js-multistream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/multiformats/js-multistream/downloads","issues_url":"https://api.github.com/repos/multiformats/js-multistream/issues{/number}","pulls_url":"https://api.github.com/repos/multiformats/js-multistream/pulls{/number}","milestones_url":"https://api.github.com/repos/multiformats/js-multistream/milestones{/number}","notifications_url":"https://api.github.com/repos/multiformats/js-multistream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/multiformats/js-multistream/labels{/name}","releases_url":"https://api.github.com/repos/multiformats/js-multistream/releases{/id}","deployments_url":"https://api.github.com/repos/multiformats/js-multistream/deployments","created_at":"2015-06-07T10:34:47Z","updated_at":"2016-08-15T20:44:52Z","pushed_at":"2016-09-04T15:34:30Z","git_url":"git://github.com/multiformats/js-multistream.git","ssh_url":"git@github.com:multiformats/js-multistream.git","clone_url":"https://github.com/multiformats/js-multistream.git","svn_url":"https://github.com/multiformats/js-multistream","homepage":"https://github.com/multiformats/multistream","size":3075,"stargazers_count":12,"watchers_count":12,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/multiformats/js-multistream/pulls/21"},"html":{"href":"https://github.com/multiformats/js-multistream/pull/21"},"issue":{"href":"https://api.github.com/repos/multiformats/js-multistream/issues/21"},"comments":{"href":"https://api.github.com/repos/multiformats/js-multistream/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/multiformats/js-multistream/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/multiformats/js-multistream/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/multiformats/js-multistream/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/multiformats/js-multistream/statuses/f59b7eb34a3d58fe5207b85781a736989efc2701"}}}}
{"actor":{"display_login":"dignifiedquire"}}