{"action":"created","comment":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/188276870","pull_request_review_id":120219110,"id":188276870,"diff_hunk":"@@ -185,30 +185,43 @@ void ConnectionHandlerImpl::ActiveListener::onAccept(\n }\n \n void ConnectionHandlerImpl::ActiveListener::newConnection(Network::ConnectionSocketPtr&& socket) {\n-  Network::ConnectionPtr new_connection = parent_.dispatcher_.createServerConnection(\n-      std::move(socket), config_.transportSocketFactory().createTransportSocket());\n+  // Find matching filter chain.\n+  const auto filter_chain = config_.filterChainManager().findFilterChain(\n+      const_cast<Network::ConnectionSocket*>(socket.get()));\n+  if (filter_chain == nullptr) {\n+    ENVOY_LOG_TO_LOGGER(parent_.logger_, debug,\n+                        \"closing connection: no matching filter chain found\");\n+    stats_.no_filter_chain_match_.inc();\n+    socket->close();\n+    return;\n+  }\n+\n+  auto transport_socket = filter_chain->createTransportSocket();\n+  Network::ConnectionPtr new_connection =\n+      parent_.dispatcher_.createServerConnection(std::move(socket), std::move(transport_socket));\n   new_connection->setBufferLimits(config_.perConnectionBufferLimitBytes());\n+\n+  const bool empty_filter_chain = !config_.filterChainFactory().createNetworkFilterChain(\n+      *new_connection, filter_chain->getNetworkFilterFactories());\n+  if (empty_filter_chain) {\n+    ENVOY_CONN_LOG_TO_LOGGER(parent_.logger_, debug, \"closing connection: no filters\",\n+                             *new_connection);\n+    new_connection->close(Network::ConnectionCloseType::NoFlush);","path":"source/server/connection_handler_impl.cc","position":27,"original_position":27,"commit_id":"c9070e369ee93d62116d53c8498bfd5955e0ee3d","original_commit_id":"c9070e369ee93d62116d53c8498bfd5955e0ee3d","user":{"login":"htuch","id":10914751,"avatar_url":"https://avatars1.githubusercontent.com/u/10914751?v=4","gravatar_id":"","url":"https://api.github.com/users/htuch","html_url":"https://github.com/htuch","followers_url":"https://api.github.com/users/htuch/followers","following_url":"https://api.github.com/users/htuch/following{/other_user}","gists_url":"https://api.github.com/users/htuch/gists{/gist_id}","starred_url":"https://api.github.com/users/htuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htuch/subscriptions","organizations_url":"https://api.github.com/users/htuch/orgs","repos_url":"https://api.github.com/users/htuch/repos","events_url":"https://api.github.com/users/htuch/events{/privacy}","received_events_url":"https://api.github.com/users/htuch/received_events","type":"User","site_admin":false},"body":"Also bump stat on this one?","created_at":"2018-05-15T13:01:05Z","updated_at":"2018-05-15T13:03:55Z","html_url":"https://github.com/envoyproxy/envoy/pull/3217#discussion_r188276870","pull_request_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/188276870"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/3217#discussion_r188276870"},"pull_request":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217"}}},"pull_request":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217","id":184196270,"html_url":"https://github.com/envoyproxy/envoy/pull/3217","diff_url":"https://github.com/envoyproxy/envoy/pull/3217.diff","patch_url":"https://github.com/envoyproxy/envoy/pull/3217.patch","issue_url":"https://api.github.com/repos/envoyproxy/envoy/issues/3217","number":3217,"state":"open","locked":false,"title":"listener: add support for multiple filter chains.","user":{"login":"PiotrSikora","id":190297,"avatar_url":"https://avatars3.githubusercontent.com/u/190297?v=4","gravatar_id":"","url":"https://api.github.com/users/PiotrSikora","html_url":"https://github.com/PiotrSikora","followers_url":"https://api.github.com/users/PiotrSikora/followers","following_url":"https://api.github.com/users/PiotrSikora/following{/other_user}","gists_url":"https://api.github.com/users/PiotrSikora/gists{/gist_id}","starred_url":"https://api.github.com/users/PiotrSikora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PiotrSikora/subscriptions","organizations_url":"https://api.github.com/users/PiotrSikora/orgs","repos_url":"https://api.github.com/users/PiotrSikora/repos","events_url":"https://api.github.com/users/PiotrSikora/events{/privacy}","received_events_url":"https://api.github.com/users/PiotrSikora/received_events","type":"User","site_admin":false},"body":"*Risk Level*: Medium\r\n*Testing*: bazel test //test/...\r\n*Docs Changes*: Added\r\n*Release Notes*: Added\r\n\r\nFixes #1843.","created_at":"2018-04-26T00:20:51Z","updated_at":"2018-05-15T13:03:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9afd367a329dcbd41900ec8434fa9382597c7d15","assignee":{"login":"mattklein123","id":6305260,"avatar_url":"https://avatars3.githubusercontent.com/u/6305260?v=4","gravatar_id":"","url":"https://api.github.com/users/mattklein123","html_url":"https://github.com/mattklein123","followers_url":"https://api.github.com/users/mattklein123/followers","following_url":"https://api.github.com/users/mattklein123/following{/other_user}","gists_url":"https://api.github.com/users/mattklein123/gists{/gist_id}","starred_url":"https://api.github.com/users/mattklein123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattklein123/subscriptions","organizations_url":"https://api.github.com/users/mattklein123/orgs","repos_url":"https://api.github.com/users/mattklein123/repos","events_url":"https://api.github.com/users/mattklein123/events{/privacy}","received_events_url":"https://api.github.com/users/mattklein123/received_events","type":"User","site_admin":false},"assignees":[{"login":"mattklein123","id":6305260,"avatar_url":"https://avatars3.githubusercontent.com/u/6305260?v=4","gravatar_id":"","url":"https://api.github.com/users/mattklein123","html_url":"https://github.com/mattklein123","followers_url":"https://api.github.com/users/mattklein123/followers","following_url":"https://api.github.com/users/mattklein123/following{/other_user}","gists_url":"https://api.github.com/users/mattklein123/gists{/gist_id}","starred_url":"https://api.github.com/users/mattklein123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattklein123/subscriptions","organizations_url":"https://api.github.com/users/mattklein123/orgs","repos_url":"https://api.github.com/users/mattklein123/repos","events_url":"https://api.github.com/users/mattklein123/events{/privacy}","received_events_url":"https://api.github.com/users/mattklein123/received_events","type":"User","site_admin":false},{"login":"ggreenway","id":8603643,"avatar_url":"https://avatars2.githubusercontent.com/u/8603643?v=4","gravatar_id":"","url":"https://api.github.com/users/ggreenway","html_url":"https://github.com/ggreenway","followers_url":"https://api.github.com/users/ggreenway/followers","following_url":"https://api.github.com/users/ggreenway/following{/other_user}","gists_url":"https://api.github.com/users/ggreenway/gists{/gist_id}","starred_url":"https://api.github.com/users/ggreenway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ggreenway/subscriptions","organizations_url":"https://api.github.com/users/ggreenway/orgs","repos_url":"https://api.github.com/users/ggreenway/repos","events_url":"https://api.github.com/users/ggreenway/events{/privacy}","received_events_url":"https://api.github.com/users/ggreenway/received_events","type":"User","site_admin":false},{"login":"htuch","id":10914751,"avatar_url":"https://avatars1.githubusercontent.com/u/10914751?v=4","gravatar_id":"","url":"https://api.github.com/users/htuch","html_url":"https://github.com/htuch","followers_url":"https://api.github.com/users/htuch/followers","following_url":"https://api.github.com/users/htuch/following{/other_user}","gists_url":"https://api.github.com/users/htuch/gists{/gist_id}","starred_url":"https://api.github.com/users/htuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htuch/subscriptions","organizations_url":"https://api.github.com/users/htuch/orgs","repos_url":"https://api.github.com/users/htuch/repos","events_url":"https://api.github.com/users/htuch/events{/privacy}","received_events_url":"https://api.github.com/users/htuch/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217/commits","review_comments_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217/comments","review_comment_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/issues/3217/comments","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/c9070e369ee93d62116d53c8498bfd5955e0ee3d","head":{"label":"PiotrSikora:multiple_filter_chains_v2","ref":"multiple_filter_chains_v2","sha":"c9070e369ee93d62116d53c8498bfd5955e0ee3d","user":{"login":"PiotrSikora","id":190297,"avatar_url":"https://avatars3.githubusercontent.com/u/190297?v=4","gravatar_id":"","url":"https://api.github.com/users/PiotrSikora","html_url":"https://github.com/PiotrSikora","followers_url":"https://api.github.com/users/PiotrSikora/followers","following_url":"https://api.github.com/users/PiotrSikora/following{/other_user}","gists_url":"https://api.github.com/users/PiotrSikora/gists{/gist_id}","starred_url":"https://api.github.com/users/PiotrSikora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PiotrSikora/subscriptions","organizations_url":"https://api.github.com/users/PiotrSikora/orgs","repos_url":"https://api.github.com/users/PiotrSikora/repos","events_url":"https://api.github.com/users/PiotrSikora/events{/privacy}","received_events_url":"https://api.github.com/users/PiotrSikora/received_events","type":"User","site_admin":false},"repo":{"id":70318420,"name":"envoy","full_name":"PiotrSikora/envoy","owner":{"login":"PiotrSikora","id":190297,"avatar_url":"https://avatars3.githubusercontent.com/u/190297?v=4","gravatar_id":"","url":"https://api.github.com/users/PiotrSikora","html_url":"https://github.com/PiotrSikora","followers_url":"https://api.github.com/users/PiotrSikora/followers","following_url":"https://api.github.com/users/PiotrSikora/following{/other_user}","gists_url":"https://api.github.com/users/PiotrSikora/gists{/gist_id}","starred_url":"https://api.github.com/users/PiotrSikora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PiotrSikora/subscriptions","organizations_url":"https://api.github.com/users/PiotrSikora/orgs","repos_url":"https://api.github.com/users/PiotrSikora/repos","events_url":"https://api.github.com/users/PiotrSikora/events{/privacy}","received_events_url":"https://api.github.com/users/PiotrSikora/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PiotrSikora/envoy","description":"C++ front/service proxy","fork":true,"url":"https://api.github.com/repos/PiotrSikora/envoy","forks_url":"https://api.github.com/repos/PiotrSikora/envoy/forks","keys_url":"https://api.github.com/repos/PiotrSikora/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PiotrSikora/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PiotrSikora/envoy/teams","hooks_url":"https://api.github.com/repos/PiotrSikora/envoy/hooks","issue_events_url":"https://api.github.com/repos/PiotrSikora/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/PiotrSikora/envoy/events","assignees_url":"https://api.github.com/repos/PiotrSikora/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/PiotrSikora/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/PiotrSikora/envoy/tags","blobs_url":"https://api.github.com/repos/PiotrSikora/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PiotrSikora/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PiotrSikora/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/PiotrSikora/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PiotrSikora/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/PiotrSikora/envoy/languages","stargazers_url":"https://api.github.com/repos/PiotrSikora/envoy/stargazers","contributors_url":"https://api.github.com/repos/PiotrSikora/envoy/contributors","subscribers_url":"https://api.github.com/repos/PiotrSikora/envoy/subscribers","subscription_url":"https://api.github.com/repos/PiotrSikora/envoy/subscription","commits_url":"https://api.github.com/repos/PiotrSikora/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/PiotrSikora/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/PiotrSikora/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/PiotrSikora/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/PiotrSikora/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/PiotrSikora/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PiotrSikora/envoy/merges","archive_url":"https://api.github.com/repos/PiotrSikora/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PiotrSikora/envoy/downloads","issues_url":"https://api.github.com/repos/PiotrSikora/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/PiotrSikora/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/PiotrSikora/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/PiotrSikora/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PiotrSikora/envoy/labels{/name}","releases_url":"https://api.github.com/repos/PiotrSikora/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/PiotrSikora/envoy/deployments","created_at":"2016-10-08T08:57:14Z","updated_at":"2016-10-08T08:57:16Z","pushed_at":"2018-05-15T05:15:40Z","git_url":"git://github.com/PiotrSikora/envoy.git","ssh_url":"git@github.com:PiotrSikora/envoy.git","clone_url":"https://github.com/PiotrSikora/envoy.git","svn_url":"https://github.com/PiotrSikora/envoy","homepage":"https://lyft.github.io/envoy","size":17853,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"envoyproxy:master","ref":"master","sha":"9f24f5eb7546c6a544dfed8ed1dc96740f1da5f7","user":{"login":"envoyproxy","id":30125649,"avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"repo":{"id":65214191,"name":"envoy","full_name":"envoyproxy/envoy","owner":{"login":"envoyproxy","id":30125649,"avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/envoyproxy/envoy","description":"C++ front/service proxy","fork":false,"url":"https://api.github.com/repos/envoyproxy/envoy","forks_url":"https://api.github.com/repos/envoyproxy/envoy/forks","keys_url":"https://api.github.com/repos/envoyproxy/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/envoyproxy/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/envoyproxy/envoy/teams","hooks_url":"https://api.github.com/repos/envoyproxy/envoy/hooks","issue_events_url":"https://api.github.com/repos/envoyproxy/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/envoyproxy/envoy/events","assignees_url":"https://api.github.com/repos/envoyproxy/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/envoyproxy/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/envoyproxy/envoy/tags","blobs_url":"https://api.github.com/repos/envoyproxy/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/envoyproxy/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/envoyproxy/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/envoyproxy/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/envoyproxy/envoy/languages","stargazers_url":"https://api.github.com/repos/envoyproxy/envoy/stargazers","contributors_url":"https://api.github.com/repos/envoyproxy/envoy/contributors","subscribers_url":"https://api.github.com/repos/envoyproxy/envoy/subscribers","subscription_url":"https://api.github.com/repos/envoyproxy/envoy/subscription","commits_url":"https://api.github.com/repos/envoyproxy/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/envoyproxy/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/envoyproxy/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/envoyproxy/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/envoyproxy/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/envoyproxy/envoy/merges","archive_url":"https://api.github.com/repos/envoyproxy/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/envoyproxy/envoy/downloads","issues_url":"https://api.github.com/repos/envoyproxy/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/envoyproxy/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/envoyproxy/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/envoyproxy/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/envoyproxy/envoy/labels{/name}","releases_url":"https://api.github.com/repos/envoyproxy/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/envoyproxy/envoy/deployments","created_at":"2016-08-08T15:07:24Z","updated_at":"2018-05-15T12:55:40Z","pushed_at":"2018-05-15T12:55:37Z","git_url":"git://github.com/envoyproxy/envoy.git","ssh_url":"git@github.com:envoyproxy/envoy.git","clone_url":"https://github.com/envoyproxy/envoy.git","svn_url":"https://github.com/envoyproxy/envoy","homepage":"https://www.envoyproxy.io","size":15413,"stargazers_count":4887,"watchers_count":4887,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":620,"mirror_url":null,"archived":false,"open_issues_count":321,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":620,"open_issues":321,"watchers":4887,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/3217"},"issue":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/3217"},"comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/3217/comments"},"review_comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217/comments"},"review_comment":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3217/commits"},"statuses":{"href":"https://api.github.com/repos/envoyproxy/envoy/statuses/c9070e369ee93d62116d53c8498bfd5955e0ee3d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"htuch"}}