{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc/pulls/comments/37915047","id":37915047,"diff_hunk":"@@ -85,40 +77,53 @@ static grpc_resolver_factory *lookup_factory(grpc_uri *uri) {\n   if (!uri) return NULL;\n \n   for (i = 0; i < g_number_of_resolvers; i++) {\n-    if (0 == strcmp(uri->scheme, g_all_of_the_resolvers[i].scheme)) {\n-      return g_all_of_the_resolvers[i].factory;\n+    if (0 == strcmp(uri->scheme, g_all_of_the_resolvers[i]->vtable->scheme)) {\n+      return g_all_of_the_resolvers[i];\n     }\n   }\n \n   return NULL;\n }\n \n-grpc_resolver *grpc_resolver_create(\n-    const char *name, grpc_subchannel_factory *subchannel_factory) {\n-  grpc_uri *uri;\n+static grpc_resolver_factory *resolve_factory(const char *target,\n+                                              grpc_uri **uri) {\n   char *tmp;\n   grpc_resolver_factory *factory = NULL;\n-  grpc_resolver *resolver;\n-\n-  uri = grpc_uri_parse(name, 1);\n-  factory = lookup_factory(uri);\n-  if (factory == NULL && g_default_resolver_scheme != NULL) {\n-    grpc_uri_destroy(uri);\n-    gpr_asprintf(&tmp, \"%s%s\", g_default_resolver_scheme, name);\n-    uri = grpc_uri_parse(tmp, 1);\n-    factory = lookup_factory(uri);\n+\n+  *uri = grpc_uri_parse(target, 1);","path":"src/core/client_config/resolver_registry.c","position":null,"original_position":83,"commit_id":"c0136b9a270e406f6eee4962ce01722c7e72dc6f","original_commit_id":"dc31ef38d2530ed814d18150755710545293a8ed","user":{"login":"ctiller","id":10120821,"avatar_url":"https://avatars.githubusercontent.com/u/10120821?v=3","gravatar_id":"","url":"https://api.github.com/users/ctiller","html_url":"https://github.com/ctiller","followers_url":"https://api.github.com/users/ctiller/followers","following_url":"https://api.github.com/users/ctiller/following{/other_user}","gists_url":"https://api.github.com/users/ctiller/gists{/gist_id}","starred_url":"https://api.github.com/users/ctiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctiller/subscriptions","organizations_url":"https://api.github.com/users/ctiller/orgs","repos_url":"https://api.github.com/users/ctiller/repos","events_url":"https://api.github.com/users/ctiller/events{/privacy}","received_events_url":"https://api.github.com/users/ctiller/received_events","type":"User","site_admin":false},"body":"ah\n\nOn Tue, Aug 25, 2015 at 11:20 AM jboeuf <notifications@github.com> wrote:\n\n> In src/core/client_config/resolver_registry.c\n> <https://github.com/grpc/grpc/pull/3035#discussion_r37900043>:\n>\n> >    char *tmp;\n> >    grpc_resolver_factory *factory = NULL;\n> > -  grpc_resolver *resolver;\n> > -\n> > -  uri = grpc_uri_parse(name, 1);\n> > -  factory = lookup_factory(uri);\n> > -  if (factory == NULL && g_default_resolver_scheme != NULL) {\n> > -    grpc_uri_destroy(uri);\n> > -    gpr_asprintf(&tmp, \"%s%s\", g_default_resolver_scheme, name);\n> > -    uri = grpc_uri_parse(tmp, 1);\n> > -    factory = lookup_factory(uri);\n> > +\n> > +  *uri = grpc_uri_parse(target, 1);\n>\n> It's fine if *uri is NULL but not if uri is NULL.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/grpc/grpc/pull/3035/files#r37900043>.\n>\n","created_at":"2015-08-25T20:28:12Z","updated_at":"2015-08-25T20:28:12Z","html_url":"https://github.com/grpc/grpc/pull/3035#discussion_r37915047","pull_request_url":"https://api.github.com/repos/grpc/grpc/pulls/3035","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc/pulls/comments/37915047"},"html":{"href":"https://github.com/grpc/grpc/pull/3035#discussion_r37915047"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc/pulls/3035"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc/pulls/3035","id":43201599,"html_url":"https://github.com/grpc/grpc/pull/3035","diff_url":"https://github.com/grpc/grpc/pull/3035.diff","patch_url":"https://github.com/grpc/grpc/pull/3035.patch","issue_url":"https://api.github.com/repos/grpc/grpc/issues/3035","number":3035,"state":"open","locked":false,"title":"Refactor default host name resolution","user":{"login":"ctiller","id":10120821,"avatar_url":"https://avatars.githubusercontent.com/u/10120821?v=3","gravatar_id":"","url":"https://api.github.com/users/ctiller","html_url":"https://github.com/ctiller","followers_url":"https://api.github.com/users/ctiller/followers","following_url":"https://api.github.com/users/ctiller/following{/other_user}","gists_url":"https://api.github.com/users/ctiller/gists{/gist_id}","starred_url":"https://api.github.com/users/ctiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctiller/subscriptions","organizations_url":"https://api.github.com/users/ctiller/orgs","repos_url":"https://api.github.com/users/ctiller/repos","events_url":"https://api.github.com/users/ctiller/events{/privacy}","received_events_url":"https://api.github.com/users/ctiller/received_events","type":"User","site_admin":false},"body":"Rephrase API's such that resolvers are constrained to be able to provide a\r\ndefault host given just the text of the URI channel target.\r\n\r\nThis avoids needing to rewrite such details in the core library during\r\nretries, and generally makes things much saner to debug.","created_at":"2015-08-24T17:46:54Z","updated_at":"2015-08-25T20:28:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f061bfcda4595d94e1a4316a42cc668c73091260","assignee":{"login":"dgquintas","id":120217,"avatar_url":"https://avatars.githubusercontent.com/u/120217?v=3","gravatar_id":"","url":"https://api.github.com/users/dgquintas","html_url":"https://github.com/dgquintas","followers_url":"https://api.github.com/users/dgquintas/followers","following_url":"https://api.github.com/users/dgquintas/following{/other_user}","gists_url":"https://api.github.com/users/dgquintas/gists{/gist_id}","starred_url":"https://api.github.com/users/dgquintas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgquintas/subscriptions","organizations_url":"https://api.github.com/users/dgquintas/orgs","repos_url":"https://api.github.com/users/dgquintas/repos","events_url":"https://api.github.com/users/dgquintas/events{/privacy}","received_events_url":"https://api.github.com/users/dgquintas/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/grpc/grpc/milestones/25","html_url":"https://github.com/grpc/grpc/milestones/Beta","labels_url":"https://api.github.com/repos/grpc/grpc/milestones/25/labels","id":1134869,"number":25,"title":"Beta","description":"","creator":{"login":"ctiller","id":10120821,"avatar_url":"https://avatars.githubusercontent.com/u/10120821?v=3","gravatar_id":"","url":"https://api.github.com/users/ctiller","html_url":"https://github.com/ctiller","followers_url":"https://api.github.com/users/ctiller/followers","following_url":"https://api.github.com/users/ctiller/following{/other_user}","gists_url":"https://api.github.com/users/ctiller/gists{/gist_id}","starred_url":"https://api.github.com/users/ctiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctiller/subscriptions","organizations_url":"https://api.github.com/users/ctiller/orgs","repos_url":"https://api.github.com/users/ctiller/repos","events_url":"https://api.github.com/users/ctiller/events{/privacy}","received_events_url":"https://api.github.com/users/ctiller/received_events","type":"User","site_admin":false},"open_issues":100,"closed_issues":427,"state":"open","created_at":"2015-05-26T22:29:20Z","updated_at":"2015-08-25T20:15:07Z","due_on":"2015-08-29T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/grpc/grpc/pulls/3035/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc/pulls/3035/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc/issues/3035/comments","statuses_url":"https://api.github.com/repos/grpc/grpc/statuses/c0136b9a270e406f6eee4962ce01722c7e72dc6f","head":{"label":"ctiller:naming-crisis","ref":"naming-crisis","sha":"c0136b9a270e406f6eee4962ce01722c7e72dc6f","user":{"login":"ctiller","id":10120821,"avatar_url":"https://avatars.githubusercontent.com/u/10120821?v=3","gravatar_id":"","url":"https://api.github.com/users/ctiller","html_url":"https://github.com/ctiller","followers_url":"https://api.github.com/users/ctiller/followers","following_url":"https://api.github.com/users/ctiller/following{/other_user}","gists_url":"https://api.github.com/users/ctiller/gists{/gist_id}","starred_url":"https://api.github.com/users/ctiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctiller/subscriptions","organizations_url":"https://api.github.com/users/ctiller/orgs","repos_url":"https://api.github.com/users/ctiller/repos","events_url":"https://api.github.com/users/ctiller/events{/privacy}","received_events_url":"https://api.github.com/users/ctiller/received_events","type":"User","site_admin":false},"repo":{"id":31379631,"name":"grpc","full_name":"ctiller/grpc","owner":{"login":"ctiller","id":10120821,"avatar_url":"https://avatars.githubusercontent.com/u/10120821?v=3","gravatar_id":"","url":"https://api.github.com/users/ctiller","html_url":"https://github.com/ctiller","followers_url":"https://api.github.com/users/ctiller/followers","following_url":"https://api.github.com/users/ctiller/following{/other_user}","gists_url":"https://api.github.com/users/ctiller/gists{/gist_id}","starred_url":"https://api.github.com/users/ctiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctiller/subscriptions","organizations_url":"https://api.github.com/users/ctiller/orgs","repos_url":"https://api.github.com/users/ctiller/repos","events_url":"https://api.github.com/users/ctiller/events{/privacy}","received_events_url":"https://api.github.com/users/ctiller/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ctiller/grpc","description":"The C based gRPC (C++, Node.js, Python, Ruby, Objective-C, PHP, C#)","fork":true,"url":"https://api.github.com/repos/ctiller/grpc","forks_url":"https://api.github.com/repos/ctiller/grpc/forks","keys_url":"https://api.github.com/repos/ctiller/grpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ctiller/grpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ctiller/grpc/teams","hooks_url":"https://api.github.com/repos/ctiller/grpc/hooks","issue_events_url":"https://api.github.com/repos/ctiller/grpc/issues/events{/number}","events_url":"https://api.github.com/repos/ctiller/grpc/events","assignees_url":"https://api.github.com/repos/ctiller/grpc/assignees{/user}","branches_url":"https://api.github.com/repos/ctiller/grpc/branches{/branch}","tags_url":"https://api.github.com/repos/ctiller/grpc/tags","blobs_url":"https://api.github.com/repos/ctiller/grpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ctiller/grpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ctiller/grpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ctiller/grpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ctiller/grpc/statuses/{sha}","languages_url":"https://api.github.com/repos/ctiller/grpc/languages","stargazers_url":"https://api.github.com/repos/ctiller/grpc/stargazers","contributors_url":"https://api.github.com/repos/ctiller/grpc/contributors","subscribers_url":"https://api.github.com/repos/ctiller/grpc/subscribers","subscription_url":"https://api.github.com/repos/ctiller/grpc/subscription","commits_url":"https://api.github.com/repos/ctiller/grpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ctiller/grpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ctiller/grpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ctiller/grpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ctiller/grpc/contents/{+path}","compare_url":"https://api.github.com/repos/ctiller/grpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ctiller/grpc/merges","archive_url":"https://api.github.com/repos/ctiller/grpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ctiller/grpc/downloads","issues_url":"https://api.github.com/repos/ctiller/grpc/issues{/number}","pulls_url":"https://api.github.com/repos/ctiller/grpc/pulls{/number}","milestones_url":"https://api.github.com/repos/ctiller/grpc/milestones{/number}","notifications_url":"https://api.github.com/repos/ctiller/grpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ctiller/grpc/labels{/name}","releases_url":"https://api.github.com/repos/ctiller/grpc/releases{/id}","created_at":"2015-02-26T17:36:22Z","updated_at":"2015-04-20T15:39:22Z","pushed_at":"2015-08-25T19:58:12Z","git_url":"git://github.com/ctiller/grpc.git","ssh_url":"git@github.com:ctiller/grpc.git","clone_url":"https://github.com/ctiller/grpc.git","svn_url":"https://github.com/ctiller/grpc","homepage":"","size":136637,"stargazers_count":2,"watchers_count":2,"language":"C","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"grpc:master","ref":"master","sha":"e289e52436505e73440854ee6f8e5ddda5750929","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":27729880,"name":"grpc","full_name":"grpc/grpc","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc","description":"The C based gRPC (C++, Node.js, Python, Ruby, Objective-C, PHP, C#)","fork":false,"url":"https://api.github.com/repos/grpc/grpc","forks_url":"https://api.github.com/repos/grpc/grpc/forks","keys_url":"https://api.github.com/repos/grpc/grpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc/teams","hooks_url":"https://api.github.com/repos/grpc/grpc/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc/events","assignees_url":"https://api.github.com/repos/grpc/grpc/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc/tags","blobs_url":"https://api.github.com/repos/grpc/grpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc/subscription","commits_url":"https://api.github.com/repos/grpc/grpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc/merges","archive_url":"https://api.github.com/repos/grpc/grpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc/downloads","issues_url":"https://api.github.com/repos/grpc/grpc/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc/releases{/id}","created_at":"2014-12-08T18:58:53Z","updated_at":"2015-08-25T16:50:53Z","pushed_at":"2015-08-25T20:10:41Z","git_url":"git://github.com/grpc/grpc.git","ssh_url":"git@github.com:grpc/grpc.git","clone_url":"https://github.com/grpc/grpc.git","svn_url":"https://github.com/grpc/grpc","homepage":"","size":162534,"stargazers_count":3093,"watchers_count":3093,"language":"C","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":459,"mirror_url":null,"open_issues_count":377,"forks":459,"open_issues":377,"watchers":3093,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc/pulls/3035"},"html":{"href":"https://github.com/grpc/grpc/pull/3035"},"issue":{"href":"https://api.github.com/repos/grpc/grpc/issues/3035"},"comments":{"href":"https://api.github.com/repos/grpc/grpc/issues/3035/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc/pulls/3035/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc/pulls/3035/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc/statuses/c0136b9a270e406f6eee4962ce01722c7e72dc6f"}}}}