{"action":"created","comment":{"url":"https://api.github.com/repos/labrad/pylabrad/pulls/comments/49257788","id":49257788,"diff_hunk":"@@ -333,5 +373,92 @@ def __init__(self, source, context, target):\n     def __repr__(self):\n         return 'MessageContext(source=%s, ID=%s, target=%s)' % (self.source, self.ID, self.target)\n \n-# factory for churning out LabRAD connections\n+\n+# factory for creating LabRAD connections\n factory = protocol.ClientCreator(reactor, LabradProtocol)","path":"labrad/protocol.py","position":115,"original_position":115,"commit_id":"4ac16f50b0fffdea18707863f1d5cac79c88179e","original_commit_id":"4ac16f50b0fffdea18707863f1d5cac79c88179e","user":{"login":"DanielSank","id":4584456,"avatar_url":"https://avatars.githubusercontent.com/u/4584456?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielSank","html_url":"https://github.com/DanielSank","followers_url":"https://api.github.com/users/DanielSank/followers","following_url":"https://api.github.com/users/DanielSank/following{/other_user}","gists_url":"https://api.github.com/users/DanielSank/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielSank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielSank/subscriptions","organizations_url":"https://api.github.com/users/DanielSank/orgs","repos_url":"https://api.github.com/users/DanielSank/repos","events_url":"https://api.github.com/users/DanielSank/events{/privacy}","received_events_url":"https://api.github.com/users/DanielSank/received_events","type":"User","site_admin":false},"body":"It was a little puzzling to me because I'm not used to anything other than functions, classes, modules, and constants sitting at the module level. I know there's not a law against having other objects in the module, it's just rare enough that it was puzzling.","created_at":"2016-01-09T01:43:28Z","updated_at":"2016-01-09T01:43:28Z","html_url":"https://github.com/labrad/pylabrad/pull/202#discussion_r49257788","pull_request_url":"https://api.github.com/repos/labrad/pylabrad/pulls/202","_links":{"self":{"href":"https://api.github.com/repos/labrad/pylabrad/pulls/comments/49257788"},"html":{"href":"https://github.com/labrad/pylabrad/pull/202#discussion_r49257788"},"pull_request":{"href":"https://api.github.com/repos/labrad/pylabrad/pulls/202"}}},"pull_request":{"url":"https://api.github.com/repos/labrad/pylabrad/pulls/202","id":54413867,"html_url":"https://github.com/labrad/pylabrad/pull/202","diff_url":"https://github.com/labrad/pylabrad/pull/202.diff","patch_url":"https://github.com/labrad/pylabrad/pull/202.patch","issue_url":"https://api.github.com/repos/labrad/pylabrad/issues/202","number":202,"state":"open","locked":false,"title":"Refactor protocol to share connection logic between server and client","user":{"login":"maffoo","id":129268,"avatar_url":"https://avatars.githubusercontent.com/u/129268?v=3","gravatar_id":"","url":"https://api.github.com/users/maffoo","html_url":"https://github.com/maffoo","followers_url":"https://api.github.com/users/maffoo/followers","following_url":"https://api.github.com/users/maffoo/following{/other_user}","gists_url":"https://api.github.com/users/maffoo/gists{/gist_id}","starred_url":"https://api.github.com/users/maffoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maffoo/subscriptions","organizations_url":"https://api.github.com/users/maffoo/orgs","repos_url":"https://api.github.com/users/maffoo/repos","events_url":"https://api.github.com/users/maffoo/events{/privacy}","received_events_url":"https://api.github.com/users/maffoo/received_events","type":"User","site_admin":false},"body":"Labrad servers and clients are both network \"clients\" in the sense that they make outbound network connections to the manager rather than accepting inbound connections. By refactoring the labrad server class to be just a plain python class rather than a twisted ClientFactory, we can reuse the same connection logic for both labrad clients and servers. This also lets us write the connection logic in a more direct style, where previously much of the server connection logic happened as a side-effect of network callbacks in the Server class which was an instance of ClientFactory.\r\n\r\nI have reworked the node to use this new connection style and tested that it still works. I think the logic there is much cleaner with fewer callbacks and more inlineCallbacks.\r\n\r\nNote that code which relies on LabradServer being a subclass of ClientFactory will have to be modified after this change. The only instance if that I know if the multi-headed data vault, which runs multiple LabradServer instances as twisted Services. This will have to be changed much as the node has been changed here.","created_at":"2015-12-22T20:54:39Z","updated_at":"2016-01-09T01:43:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae2777d4f6b5701949014db4f4a9d7986fde2f7f","assignee":{"login":"DanielSank","id":4584456,"avatar_url":"https://avatars.githubusercontent.com/u/4584456?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielSank","html_url":"https://github.com/DanielSank","followers_url":"https://api.github.com/users/DanielSank/followers","following_url":"https://api.github.com/users/DanielSank/following{/other_user}","gists_url":"https://api.github.com/users/DanielSank/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielSank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielSank/subscriptions","organizations_url":"https://api.github.com/users/DanielSank/orgs","repos_url":"https://api.github.com/users/DanielSank/repos","events_url":"https://api.github.com/users/DanielSank/events{/privacy}","received_events_url":"https://api.github.com/users/DanielSank/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/labrad/pylabrad/pulls/202/commits","review_comments_url":"https://api.github.com/repos/labrad/pylabrad/pulls/202/comments","review_comment_url":"https://api.github.com/repos/labrad/pylabrad/pulls/comments{/number}","comments_url":"https://api.github.com/repos/labrad/pylabrad/issues/202/comments","statuses_url":"https://api.github.com/repos/labrad/pylabrad/statuses/4ac16f50b0fffdea18707863f1d5cac79c88179e","head":{"label":"labrad:u/maffoo/protocol-cleanup","ref":"u/maffoo/protocol-cleanup","sha":"4ac16f50b0fffdea18707863f1d5cac79c88179e","user":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"repo":{"id":11461524,"name":"pylabrad","full_name":"labrad/pylabrad","owner":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/labrad/pylabrad","description":"python interface for labrad","fork":false,"url":"https://api.github.com/repos/labrad/pylabrad","forks_url":"https://api.github.com/repos/labrad/pylabrad/forks","keys_url":"https://api.github.com/repos/labrad/pylabrad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/labrad/pylabrad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/labrad/pylabrad/teams","hooks_url":"https://api.github.com/repos/labrad/pylabrad/hooks","issue_events_url":"https://api.github.com/repos/labrad/pylabrad/issues/events{/number}","events_url":"https://api.github.com/repos/labrad/pylabrad/events","assignees_url":"https://api.github.com/repos/labrad/pylabrad/assignees{/user}","branches_url":"https://api.github.com/repos/labrad/pylabrad/branches{/branch}","tags_url":"https://api.github.com/repos/labrad/pylabrad/tags","blobs_url":"https://api.github.com/repos/labrad/pylabrad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/labrad/pylabrad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/labrad/pylabrad/git/refs{/sha}","trees_url":"https://api.github.com/repos/labrad/pylabrad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/labrad/pylabrad/statuses/{sha}","languages_url":"https://api.github.com/repos/labrad/pylabrad/languages","stargazers_url":"https://api.github.com/repos/labrad/pylabrad/stargazers","contributors_url":"https://api.github.com/repos/labrad/pylabrad/contributors","subscribers_url":"https://api.github.com/repos/labrad/pylabrad/subscribers","subscription_url":"https://api.github.com/repos/labrad/pylabrad/subscription","commits_url":"https://api.github.com/repos/labrad/pylabrad/commits{/sha}","git_commits_url":"https://api.github.com/repos/labrad/pylabrad/git/commits{/sha}","comments_url":"https://api.github.com/repos/labrad/pylabrad/comments{/number}","issue_comment_url":"https://api.github.com/repos/labrad/pylabrad/issues/comments{/number}","contents_url":"https://api.github.com/repos/labrad/pylabrad/contents/{+path}","compare_url":"https://api.github.com/repos/labrad/pylabrad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/labrad/pylabrad/merges","archive_url":"https://api.github.com/repos/labrad/pylabrad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/labrad/pylabrad/downloads","issues_url":"https://api.github.com/repos/labrad/pylabrad/issues{/number}","pulls_url":"https://api.github.com/repos/labrad/pylabrad/pulls{/number}","milestones_url":"https://api.github.com/repos/labrad/pylabrad/milestones{/number}","notifications_url":"https://api.github.com/repos/labrad/pylabrad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/labrad/pylabrad/labels{/name}","releases_url":"https://api.github.com/repos/labrad/pylabrad/releases{/id}","created_at":"2013-07-16T22:08:52Z","updated_at":"2015-12-17T19:19:17Z","pushed_at":"2016-01-05T22:56:22Z","git_url":"git://github.com/labrad/pylabrad.git","ssh_url":"git@github.com:labrad/pylabrad.git","clone_url":"https://github.com/labrad/pylabrad.git","svn_url":"https://github.com/labrad/pylabrad","homepage":"","size":6848,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":46,"forks":5,"open_issues":46,"watchers":10,"default_branch":"master"}},"base":{"label":"labrad:master","ref":"master","sha":"d8de1f251de37bfec887a393e51d656961c02c77","user":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"repo":{"id":11461524,"name":"pylabrad","full_name":"labrad/pylabrad","owner":{"login":"labrad","id":7157139,"avatar_url":"https://avatars.githubusercontent.com/u/7157139?v=3","gravatar_id":"","url":"https://api.github.com/users/labrad","html_url":"https://github.com/labrad","followers_url":"https://api.github.com/users/labrad/followers","following_url":"https://api.github.com/users/labrad/following{/other_user}","gists_url":"https://api.github.com/users/labrad/gists{/gist_id}","starred_url":"https://api.github.com/users/labrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/labrad/subscriptions","organizations_url":"https://api.github.com/users/labrad/orgs","repos_url":"https://api.github.com/users/labrad/repos","events_url":"https://api.github.com/users/labrad/events{/privacy}","received_events_url":"https://api.github.com/users/labrad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/labrad/pylabrad","description":"python interface for labrad","fork":false,"url":"https://api.github.com/repos/labrad/pylabrad","forks_url":"https://api.github.com/repos/labrad/pylabrad/forks","keys_url":"https://api.github.com/repos/labrad/pylabrad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/labrad/pylabrad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/labrad/pylabrad/teams","hooks_url":"https://api.github.com/repos/labrad/pylabrad/hooks","issue_events_url":"https://api.github.com/repos/labrad/pylabrad/issues/events{/number}","events_url":"https://api.github.com/repos/labrad/pylabrad/events","assignees_url":"https://api.github.com/repos/labrad/pylabrad/assignees{/user}","branches_url":"https://api.github.com/repos/labrad/pylabrad/branches{/branch}","tags_url":"https://api.github.com/repos/labrad/pylabrad/tags","blobs_url":"https://api.github.com/repos/labrad/pylabrad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/labrad/pylabrad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/labrad/pylabrad/git/refs{/sha}","trees_url":"https://api.github.com/repos/labrad/pylabrad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/labrad/pylabrad/statuses/{sha}","languages_url":"https://api.github.com/repos/labrad/pylabrad/languages","stargazers_url":"https://api.github.com/repos/labrad/pylabrad/stargazers","contributors_url":"https://api.github.com/repos/labrad/pylabrad/contributors","subscribers_url":"https://api.github.com/repos/labrad/pylabrad/subscribers","subscription_url":"https://api.github.com/repos/labrad/pylabrad/subscription","commits_url":"https://api.github.com/repos/labrad/pylabrad/commits{/sha}","git_commits_url":"https://api.github.com/repos/labrad/pylabrad/git/commits{/sha}","comments_url":"https://api.github.com/repos/labrad/pylabrad/comments{/number}","issue_comment_url":"https://api.github.com/repos/labrad/pylabrad/issues/comments{/number}","contents_url":"https://api.github.com/repos/labrad/pylabrad/contents/{+path}","compare_url":"https://api.github.com/repos/labrad/pylabrad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/labrad/pylabrad/merges","archive_url":"https://api.github.com/repos/labrad/pylabrad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/labrad/pylabrad/downloads","issues_url":"https://api.github.com/repos/labrad/pylabrad/issues{/number}","pulls_url":"https://api.github.com/repos/labrad/pylabrad/pulls{/number}","milestones_url":"https://api.github.com/repos/labrad/pylabrad/milestones{/number}","notifications_url":"https://api.github.com/repos/labrad/pylabrad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/labrad/pylabrad/labels{/name}","releases_url":"https://api.github.com/repos/labrad/pylabrad/releases{/id}","created_at":"2013-07-16T22:08:52Z","updated_at":"2015-12-17T19:19:17Z","pushed_at":"2016-01-05T22:56:22Z","git_url":"git://github.com/labrad/pylabrad.git","ssh_url":"git@github.com:labrad/pylabrad.git","clone_url":"https://github.com/labrad/pylabrad.git","svn_url":"https://github.com/labrad/pylabrad","homepage":"","size":6848,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":46,"forks":5,"open_issues":46,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/labrad/pylabrad/pulls/202"},"html":{"href":"https://github.com/labrad/pylabrad/pull/202"},"issue":{"href":"https://api.github.com/repos/labrad/pylabrad/issues/202"},"comments":{"href":"https://api.github.com/repos/labrad/pylabrad/issues/202/comments"},"review_comments":{"href":"https://api.github.com/repos/labrad/pylabrad/pulls/202/comments"},"review_comment":{"href":"https://api.github.com/repos/labrad/pylabrad/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/labrad/pylabrad/pulls/202/commits"},"statuses":{"href":"https://api.github.com/repos/labrad/pylabrad/statuses/4ac16f50b0fffdea18707863f1d5cac79c88179e"}}}}