{"action":"created","comment":{"url":"https://api.github.com/repos/srsudar/SemCache/pulls/comments/75541945","id":75541945,"diff_hunk":"@@ -0,0 +1,585 @@\n+/*jshint esnext:true*/\n+/* globals Promise */\n+'use strict';\n+\n+var chromeUdp = require('../chrome-apis/udp');\n+var dnsUtil = require('./dns-util');\n+var dnsPacket = require('./dns-packet');\n+var byteArray = require('./byte-array');\n+var dnsCodes = require('./dns-codes');\n+var qSection = require('./question-section');\n+\n+/**\n+ * This module maintains DNS state and serves as the DNS server. It is\n+ * responsible for issuing DNS requests.\n+ */\n+\n+var DNSSD_MULTICAST_GROUP = '224.0.0.251';\n+var DNSSD_PORT = 53531;\n+var DNSSD_SERVICE_NAME = '_services._dns-sd._udp.local';\n+\n+/** True if the service has started. */\n+var started = false;\n+\n+exports.DNSSD_MULTICAST_GROUP = DNSSD_MULTICAST_GROUP;\n+exports.DNSSD_PORT = DNSSD_PORT;\n+exports.DNSSD_SERVICE_NAME = DNSSD_SERVICE_NAME;\n+\n+/**\n+ * These are the records owned by this module. They are maintained in an object\n+ * of domain name to array of records, e.g. { 'www.example.com': [Object,\n+ * Object, Object], 'www.foo.com': [Object] }.\n+ */\n+var records = {};\n+\n+var onReceiveCallbacks = [];\n+\n+/**\n+ * The IPv4 interfaces for this machine, cached to provide synchronous calls.\n+ */\n+var ipv4Interfaces = [];\n+\n+/**\n+ * Returns all records known to this module.\n+ *\n+ * @return {Array<resource record>} all the resource records known to this\n+ * module\n+ */\n+exports.getRecords = function() {\n+  return records;\n+};\n+\n+/**\n+ * Returns all the callbacks currently registered to be invoked with incoming\n+ * packets.\n+ *\n+ * @return {Array<function>} all the onReceive callbacks that have been\n+ * registered\n+ */\n+exports.getOnReceiveCallbacks = function() {\n+  return onReceiveCallbacks;\n+};\n+\n+/**\n+ * The socket used for accessing the network. Object of type\n+ * chromeUdp.ChromeUdpSocket.\n+ */\n+exports.socket = null;\n+/** The information about the socket we are using. */\n+exports.socketInfo = null;\n+\n+/**\n+ * True if the service is started.\n+ *\n+ * @return {boolean} representing whether or not the service has started\n+ */\n+exports.isStarted = function() {\n+  return started;\n+};\n+\n+/**\n+ * Return a cached array of IPv4 interfaces for this machine.\n+ *\n+ * @return {object} an array of all the IPv4 interfaces known to this machine.\n+ * The objects have the form: \n+ * {\n+ *   name: string,\n+ *   address: string,\n+ *   prefixLength: integer\n+ * }\n+ */\n+exports.getIPv4Interfaces = function() {\n+  if (!exports.isStarted()) {\n+    console.log('Called getIPv4Interfaces when controller was not started');\n+  }\n+  if (!ipv4Interfaces) {\n+    return [];\n+  } else {\n+    return ipv4Interfaces;\n+  }\n+};\n+\n+/**\n+ * Add a callback to be invoked with received packets.\n+ *\n+ * @param {function} callback a callback to be invoked with received packets.\n+ */\n+exports.addOnReceiveCallback = function(callback) {","path":"chromeapp/app/scripts/dnssd/dns-controller.js","position":107,"original_position":107,"commit_id":"49db7601a8c88df91ecc2f38c2fb41505c5bfc33","original_commit_id":"49db7601a8c88df91ecc2f38c2fb41505c5bfc33","user":{"login":"srsudar","id":6362625,"avatar_url":"https://avatars.githubusercontent.com/u/6362625?v=3","gravatar_id":"","url":"https://api.github.com/users/srsudar","html_url":"https://github.com/srsudar","followers_url":"https://api.github.com/users/srsudar/followers","following_url":"https://api.github.com/users/srsudar/following{/other_user}","gists_url":"https://api.github.com/users/srsudar/gists{/gist_id}","starred_url":"https://api.github.com/users/srsudar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srsudar/subscriptions","organizations_url":"https://api.github.com/users/srsudar/orgs","repos_url":"https://api.github.com/users/srsudar/repos","events_url":"https://api.github.com/users/srsudar/events{/privacy}","received_events_url":"https://api.github.com/users/srsudar/received_events","type":"User","site_admin":false},"body":"done","created_at":"2016-08-19T19:52:09Z","updated_at":"2016-08-19T19:52:09Z","html_url":"https://github.com/srsudar/SemCache/pull/12#discussion_r75541945","pull_request_url":"https://api.github.com/repos/srsudar/SemCache/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/srsudar/SemCache/pulls/comments/75541945"},"html":{"href":"https://github.com/srsudar/SemCache/pull/12#discussion_r75541945"},"pull_request":{"href":"https://api.github.com/repos/srsudar/SemCache/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/srsudar/SemCache/pulls/12","id":81552236,"html_url":"https://github.com/srsudar/SemCache/pull/12","diff_url":"https://github.com/srsudar/SemCache/pull/12.diff","patch_url":"https://github.com/srsudar/SemCache/pull/12.patch","issue_url":"https://api.github.com/repos/srsudar/SemCache/issues/12","number":12,"state":"open","locked":false,"title":"Add the dns-controller module for review","user":{"login":"srsudar","id":6362625,"avatar_url":"https://avatars.githubusercontent.com/u/6362625?v=3","gravatar_id":"","url":"https://api.github.com/users/srsudar","html_url":"https://github.com/srsudar","followers_url":"https://api.github.com/users/srsudar/followers","following_url":"https://api.github.com/users/srsudar/following{/other_user}","gists_url":"https://api.github.com/users/srsudar/gists{/gist_id}","starred_url":"https://api.github.com/users/srsudar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srsudar/subscriptions","organizations_url":"https://api.github.com/users/srsudar/orgs","repos_url":"https://api.github.com/users/srsudar/repos","events_url":"https://api.github.com/users/srsudar/events{/privacy}","received_events_url":"https://api.github.com/users/srsudar/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-16T21:59:05Z","updated_at":"2016-08-19T19:52:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86b1d835e8d5297e3ab5deec4ab743ed10a6f891","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/srsudar/SemCache/pulls/12/commits","review_comments_url":"https://api.github.com/repos/srsudar/SemCache/pulls/12/comments","review_comment_url":"https://api.github.com/repos/srsudar/SemCache/pulls/comments{/number}","comments_url":"https://api.github.com/repos/srsudar/SemCache/issues/12/comments","statuses_url":"https://api.github.com/repos/srsudar/SemCache/statuses/49db7601a8c88df91ecc2f38c2fb41505c5bfc33","head":{"label":"srsudar:cr-dnssd-dnsController","ref":"cr-dnssd-dnsController","sha":"49db7601a8c88df91ecc2f38c2fb41505c5bfc33","user":{"login":"srsudar","id":6362625,"avatar_url":"https://avatars.githubusercontent.com/u/6362625?v=3","gravatar_id":"","url":"https://api.github.com/users/srsudar","html_url":"https://github.com/srsudar","followers_url":"https://api.github.com/users/srsudar/followers","following_url":"https://api.github.com/users/srsudar/following{/other_user}","gists_url":"https://api.github.com/users/srsudar/gists{/gist_id}","starred_url":"https://api.github.com/users/srsudar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srsudar/subscriptions","organizations_url":"https://api.github.com/users/srsudar/orgs","repos_url":"https://api.github.com/users/srsudar/repos","events_url":"https://api.github.com/users/srsudar/events{/privacy}","received_events_url":"https://api.github.com/users/srsudar/received_events","type":"User","site_admin":false},"repo":{"id":61166254,"name":"SemCache","full_name":"srsudar/SemCache","owner":{"login":"srsudar","id":6362625,"avatar_url":"https://avatars.githubusercontent.com/u/6362625?v=3","gravatar_id":"","url":"https://api.github.com/users/srsudar","html_url":"https://github.com/srsudar","followers_url":"https://api.github.com/users/srsudar/followers","following_url":"https://api.github.com/users/srsudar/following{/other_user}","gists_url":"https://api.github.com/users/srsudar/gists{/gist_id}","starred_url":"https://api.github.com/users/srsudar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srsudar/subscriptions","organizations_url":"https://api.github.com/users/srsudar/orgs","repos_url":"https://api.github.com/users/srsudar/repos","events_url":"https://api.github.com/users/srsudar/events{/privacy}","received_events_url":"https://api.github.com/users/srsudar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/srsudar/SemCache","description":"Save pages offline and share them on a local network.","fork":false,"url":"https://api.github.com/repos/srsudar/SemCache","forks_url":"https://api.github.com/repos/srsudar/SemCache/forks","keys_url":"https://api.github.com/repos/srsudar/SemCache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/srsudar/SemCache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/srsudar/SemCache/teams","hooks_url":"https://api.github.com/repos/srsudar/SemCache/hooks","issue_events_url":"https://api.github.com/repos/srsudar/SemCache/issues/events{/number}","events_url":"https://api.github.com/repos/srsudar/SemCache/events","assignees_url":"https://api.github.com/repos/srsudar/SemCache/assignees{/user}","branches_url":"https://api.github.com/repos/srsudar/SemCache/branches{/branch}","tags_url":"https://api.github.com/repos/srsudar/SemCache/tags","blobs_url":"https://api.github.com/repos/srsudar/SemCache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/srsudar/SemCache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/srsudar/SemCache/git/refs{/sha}","trees_url":"https://api.github.com/repos/srsudar/SemCache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/srsudar/SemCache/statuses/{sha}","languages_url":"https://api.github.com/repos/srsudar/SemCache/languages","stargazers_url":"https://api.github.com/repos/srsudar/SemCache/stargazers","contributors_url":"https://api.github.com/repos/srsudar/SemCache/contributors","subscribers_url":"https://api.github.com/repos/srsudar/SemCache/subscribers","subscription_url":"https://api.github.com/repos/srsudar/SemCache/subscription","commits_url":"https://api.github.com/repos/srsudar/SemCache/commits{/sha}","git_commits_url":"https://api.github.com/repos/srsudar/SemCache/git/commits{/sha}","comments_url":"https://api.github.com/repos/srsudar/SemCache/comments{/number}","issue_comment_url":"https://api.github.com/repos/srsudar/SemCache/issues/comments{/number}","contents_url":"https://api.github.com/repos/srsudar/SemCache/contents/{+path}","compare_url":"https://api.github.com/repos/srsudar/SemCache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/srsudar/SemCache/merges","archive_url":"https://api.github.com/repos/srsudar/SemCache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/srsudar/SemCache/downloads","issues_url":"https://api.github.com/repos/srsudar/SemCache/issues{/number}","pulls_url":"https://api.github.com/repos/srsudar/SemCache/pulls{/number}","milestones_url":"https://api.github.com/repos/srsudar/SemCache/milestones{/number}","notifications_url":"https://api.github.com/repos/srsudar/SemCache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/srsudar/SemCache/labels{/name}","releases_url":"https://api.github.com/repos/srsudar/SemCache/releases{/id}","deployments_url":"https://api.github.com/repos/srsudar/SemCache/deployments","created_at":"2016-06-15T00:52:55Z","updated_at":"2016-06-15T00:53:28Z","pushed_at":"2016-08-19T18:28:33Z","git_url":"git://github.com/srsudar/SemCache.git","ssh_url":"git@github.com:srsudar/SemCache.git","clone_url":"https://github.com/srsudar/SemCache.git","svn_url":"https://github.com/srsudar/SemCache","homepage":null,"size":1162,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"base":{"label":"srsudar:reviewed","ref":"reviewed","sha":"89aba39396bf7f29d8562f62f19df6b979995895","user":{"login":"srsudar","id":6362625,"avatar_url":"https://avatars.githubusercontent.com/u/6362625?v=3","gravatar_id":"","url":"https://api.github.com/users/srsudar","html_url":"https://github.com/srsudar","followers_url":"https://api.github.com/users/srsudar/followers","following_url":"https://api.github.com/users/srsudar/following{/other_user}","gists_url":"https://api.github.com/users/srsudar/gists{/gist_id}","starred_url":"https://api.github.com/users/srsudar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srsudar/subscriptions","organizations_url":"https://api.github.com/users/srsudar/orgs","repos_url":"https://api.github.com/users/srsudar/repos","events_url":"https://api.github.com/users/srsudar/events{/privacy}","received_events_url":"https://api.github.com/users/srsudar/received_events","type":"User","site_admin":false},"repo":{"id":61166254,"name":"SemCache","full_name":"srsudar/SemCache","owner":{"login":"srsudar","id":6362625,"avatar_url":"https://avatars.githubusercontent.com/u/6362625?v=3","gravatar_id":"","url":"https://api.github.com/users/srsudar","html_url":"https://github.com/srsudar","followers_url":"https://api.github.com/users/srsudar/followers","following_url":"https://api.github.com/users/srsudar/following{/other_user}","gists_url":"https://api.github.com/users/srsudar/gists{/gist_id}","starred_url":"https://api.github.com/users/srsudar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srsudar/subscriptions","organizations_url":"https://api.github.com/users/srsudar/orgs","repos_url":"https://api.github.com/users/srsudar/repos","events_url":"https://api.github.com/users/srsudar/events{/privacy}","received_events_url":"https://api.github.com/users/srsudar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/srsudar/SemCache","description":"Save pages offline and share them on a local network.","fork":false,"url":"https://api.github.com/repos/srsudar/SemCache","forks_url":"https://api.github.com/repos/srsudar/SemCache/forks","keys_url":"https://api.github.com/repos/srsudar/SemCache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/srsudar/SemCache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/srsudar/SemCache/teams","hooks_url":"https://api.github.com/repos/srsudar/SemCache/hooks","issue_events_url":"https://api.github.com/repos/srsudar/SemCache/issues/events{/number}","events_url":"https://api.github.com/repos/srsudar/SemCache/events","assignees_url":"https://api.github.com/repos/srsudar/SemCache/assignees{/user}","branches_url":"https://api.github.com/repos/srsudar/SemCache/branches{/branch}","tags_url":"https://api.github.com/repos/srsudar/SemCache/tags","blobs_url":"https://api.github.com/repos/srsudar/SemCache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/srsudar/SemCache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/srsudar/SemCache/git/refs{/sha}","trees_url":"https://api.github.com/repos/srsudar/SemCache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/srsudar/SemCache/statuses/{sha}","languages_url":"https://api.github.com/repos/srsudar/SemCache/languages","stargazers_url":"https://api.github.com/repos/srsudar/SemCache/stargazers","contributors_url":"https://api.github.com/repos/srsudar/SemCache/contributors","subscribers_url":"https://api.github.com/repos/srsudar/SemCache/subscribers","subscription_url":"https://api.github.com/repos/srsudar/SemCache/subscription","commits_url":"https://api.github.com/repos/srsudar/SemCache/commits{/sha}","git_commits_url":"https://api.github.com/repos/srsudar/SemCache/git/commits{/sha}","comments_url":"https://api.github.com/repos/srsudar/SemCache/comments{/number}","issue_comment_url":"https://api.github.com/repos/srsudar/SemCache/issues/comments{/number}","contents_url":"https://api.github.com/repos/srsudar/SemCache/contents/{+path}","compare_url":"https://api.github.com/repos/srsudar/SemCache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/srsudar/SemCache/merges","archive_url":"https://api.github.com/repos/srsudar/SemCache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/srsudar/SemCache/downloads","issues_url":"https://api.github.com/repos/srsudar/SemCache/issues{/number}","pulls_url":"https://api.github.com/repos/srsudar/SemCache/pulls{/number}","milestones_url":"https://api.github.com/repos/srsudar/SemCache/milestones{/number}","notifications_url":"https://api.github.com/repos/srsudar/SemCache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/srsudar/SemCache/labels{/name}","releases_url":"https://api.github.com/repos/srsudar/SemCache/releases{/id}","deployments_url":"https://api.github.com/repos/srsudar/SemCache/deployments","created_at":"2016-06-15T00:52:55Z","updated_at":"2016-06-15T00:53:28Z","pushed_at":"2016-08-19T18:28:33Z","git_url":"git://github.com/srsudar/SemCache.git","ssh_url":"git@github.com:srsudar/SemCache.git","clone_url":"https://github.com/srsudar/SemCache.git","svn_url":"https://github.com/srsudar/SemCache","homepage":null,"size":1162,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/srsudar/SemCache/pulls/12"},"html":{"href":"https://github.com/srsudar/SemCache/pull/12"},"issue":{"href":"https://api.github.com/repos/srsudar/SemCache/issues/12"},"comments":{"href":"https://api.github.com/repos/srsudar/SemCache/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/srsudar/SemCache/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/srsudar/SemCache/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/srsudar/SemCache/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/srsudar/SemCache/statuses/49db7601a8c88df91ecc2f38c2fb41505c5bfc33"}}}}
{"actor":{"display_login":"srsudar"}}