{"action":"created","comment":{"url":"https://api.github.com/repos/square/okhttp/pulls/comments/46080370","id":46080370,"diff_hunk":"@@ -0,0 +1,381 @@\n+/*\n+ * Copyright (C) 2015 Square, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package com.squareup.okhttp.internal.http;\n+\n+import com.squareup.okhttp.Address;\n+import com.squareup.okhttp.ConnectionPool;\n+import com.squareup.okhttp.Route;\n+import com.squareup.okhttp.internal.Internal;\n+import com.squareup.okhttp.internal.RouteDatabase;\n+import com.squareup.okhttp.internal.Util;\n+import com.squareup.okhttp.internal.io.RealConnection;\n+import java.io.IOException;\n+import java.io.InterruptedIOException;\n+import java.net.ProtocolException;\n+import java.net.SocketTimeoutException;\n+import java.security.cert.CertificateException;\n+import javax.net.ssl.SSLHandshakeException;\n+import javax.net.ssl.SSLPeerUnverifiedException;\n+import okio.Sink;\n+\n+import static java.util.concurrent.TimeUnit.MILLISECONDS;\n+\n+/**\n+ * This class coordinates the relationship between three entities:\n+ *\n+ * <ul>\n+ *   <li><strong>Connections:</strong> physical socket connections to remote servers. These are\n+ *       potentially slow to establish so it is necessary to be able to cancel a connection\n+ *       currently being connected.\n+ *   <li><strong>Streams:</strong> logical HTTP request/response pairs that are layered on\n+ *       connections. Each connection has its own allocation limit, which defines how many\n+ *       concurrent streams that connection can carry. HTTP/1.x connections can carry 1 stream\n+ *       at a time, SPDY and HTTP/2 typically carry multiple.\n+ *   <li><strong>Calls:</strong> a logical sequence of streams, typically an initial request and\n+ *       its follow up requests. We prefer to keep all streams of a single call on the same\n+ *       connection for better behavior and locality.\n+ * </ul>\n+ *\n+ * <p>Instances of this class act on behalf of the call, using one or more streams over one or\n+ * more connections. This class has APIs to release each of the above resources:\n+ *\n+ * <ul>\n+ *   <li>{@linkplain #noNewStreams() noNewStreams()} prevents the connection from being used for","path":"okhttp/src/main/java/com/squareup/okhttp/internal/http/StreamAllocation.java","position":56,"original_position":56,"commit_id":"afc415362addd89ee1eeba7bf690dc27d310a19d","original_commit_id":"afc415362addd89ee1eeba7bf690dc27d310a19d","user":{"login":"swankjesse","id":133019,"avatar_url":"https://avatars.githubusercontent.com/u/133019?v=3","gravatar_id":"","url":"https://api.github.com/users/swankjesse","html_url":"https://github.com/swankjesse","followers_url":"https://api.github.com/users/swankjesse/followers","following_url":"https://api.github.com/users/swankjesse/following{/other_user}","gists_url":"https://api.github.com/users/swankjesse/gists{/gist_id}","starred_url":"https://api.github.com/users/swankjesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swankjesse/subscriptions","organizations_url":"https://api.github.com/users/swankjesse/orgs","repos_url":"https://api.github.com/users/swankjesse/repos","events_url":"https://api.github.com/users/swankjesse/events{/privacy}","received_events_url":"https://api.github.com/users/swankjesse/received_events","type":"User","site_admin":false},"body":"Fixed!","created_at":"2015-11-28T14:35:40Z","updated_at":"2015-11-28T14:35:40Z","html_url":"https://github.com/square/okhttp/pull/2045#discussion_r46080370","pull_request_url":"https://api.github.com/repos/square/okhttp/pulls/2045","_links":{"self":{"href":"https://api.github.com/repos/square/okhttp/pulls/comments/46080370"},"html":{"href":"https://github.com/square/okhttp/pull/2045#discussion_r46080370"},"pull_request":{"href":"https://api.github.com/repos/square/okhttp/pulls/2045"}}},"pull_request":{"url":"https://api.github.com/repos/square/okhttp/pulls/2045","id":52033892,"html_url":"https://github.com/square/okhttp/pull/2045","diff_url":"https://github.com/square/okhttp/pull/2045.diff","patch_url":"https://github.com/square/okhttp/pull/2045.patch","issue_url":"https://api.github.com/repos/square/okhttp/issues/2045","number":2045,"state":"open","locked":false,"title":"First draft of the new new stream allocations model.","user":{"login":"swankjesse","id":133019,"avatar_url":"https://avatars.githubusercontent.com/u/133019?v=3","gravatar_id":"","url":"https://api.github.com/users/swankjesse","html_url":"https://github.com/swankjesse","followers_url":"https://api.github.com/users/swankjesse/followers","following_url":"https://api.github.com/users/swankjesse/following{/other_user}","gists_url":"https://api.github.com/users/swankjesse/gists{/gist_id}","starred_url":"https://api.github.com/users/swankjesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swankjesse/subscriptions","organizations_url":"https://api.github.com/users/swankjesse/orgs","repos_url":"https://api.github.com/users/swankjesse/repos","events_url":"https://api.github.com/users/swankjesse/events{/privacy}","received_events_url":"https://api.github.com/users/swankjesse/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-28T05:29:54Z","updated_at":"2015-11-28T14:35:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d592722fe61ac2dd31b91edac8454f3dd9638c7c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/square/okhttp/pulls/2045/commits","review_comments_url":"https://api.github.com/repos/square/okhttp/pulls/2045/comments","review_comment_url":"https://api.github.com/repos/square/okhttp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/square/okhttp/issues/2045/comments","statuses_url":"https://api.github.com/repos/square/okhttp/statuses/afc415362addd89ee1eeba7bf690dc27d310a19d","head":{"label":"square:jwilson_1127_new_connections_model","ref":"jwilson_1127_new_connections_model","sha":"afc415362addd89ee1eeba7bf690dc27d310a19d","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":5152285,"name":"okhttp","full_name":"square/okhttp","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/okhttp","description":"An HTTP+SPDY client for Android and Java applications.","fork":false,"url":"https://api.github.com/repos/square/okhttp","forks_url":"https://api.github.com/repos/square/okhttp/forks","keys_url":"https://api.github.com/repos/square/okhttp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/okhttp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/okhttp/teams","hooks_url":"https://api.github.com/repos/square/okhttp/hooks","issue_events_url":"https://api.github.com/repos/square/okhttp/issues/events{/number}","events_url":"https://api.github.com/repos/square/okhttp/events","assignees_url":"https://api.github.com/repos/square/okhttp/assignees{/user}","branches_url":"https://api.github.com/repos/square/okhttp/branches{/branch}","tags_url":"https://api.github.com/repos/square/okhttp/tags","blobs_url":"https://api.github.com/repos/square/okhttp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/okhttp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/okhttp/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/okhttp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/okhttp/statuses/{sha}","languages_url":"https://api.github.com/repos/square/okhttp/languages","stargazers_url":"https://api.github.com/repos/square/okhttp/stargazers","contributors_url":"https://api.github.com/repos/square/okhttp/contributors","subscribers_url":"https://api.github.com/repos/square/okhttp/subscribers","subscription_url":"https://api.github.com/repos/square/okhttp/subscription","commits_url":"https://api.github.com/repos/square/okhttp/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/okhttp/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/okhttp/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/okhttp/issues/comments{/number}","contents_url":"https://api.github.com/repos/square/okhttp/contents/{+path}","compare_url":"https://api.github.com/repos/square/okhttp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/okhttp/merges","archive_url":"https://api.github.com/repos/square/okhttp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/okhttp/downloads","issues_url":"https://api.github.com/repos/square/okhttp/issues{/number}","pulls_url":"https://api.github.com/repos/square/okhttp/pulls{/number}","milestones_url":"https://api.github.com/repos/square/okhttp/milestones{/number}","notifications_url":"https://api.github.com/repos/square/okhttp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/okhttp/labels{/name}","releases_url":"https://api.github.com/repos/square/okhttp/releases{/id}","created_at":"2012-07-23T13:42:55Z","updated_at":"2015-11-28T14:24:41Z","pushed_at":"2015-11-28T05:29:54Z","git_url":"git://github.com/square/okhttp.git","ssh_url":"git@github.com:square/okhttp.git","clone_url":"https://github.com/square/okhttp.git","svn_url":"https://github.com/square/okhttp","homepage":"http://square.github.io/okhttp/","size":12521,"stargazers_count":7406,"watchers_count":7406,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1819,"mirror_url":null,"open_issues_count":107,"forks":1819,"open_issues":107,"watchers":7406,"default_branch":"master"}},"base":{"label":"square:master","ref":"master","sha":"e0d34ebdd7aba18149d195804075a87b97f3c02d","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":5152285,"name":"okhttp","full_name":"square/okhttp","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/okhttp","description":"An HTTP+SPDY client for Android and Java applications.","fork":false,"url":"https://api.github.com/repos/square/okhttp","forks_url":"https://api.github.com/repos/square/okhttp/forks","keys_url":"https://api.github.com/repos/square/okhttp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/okhttp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/okhttp/teams","hooks_url":"https://api.github.com/repos/square/okhttp/hooks","issue_events_url":"https://api.github.com/repos/square/okhttp/issues/events{/number}","events_url":"https://api.github.com/repos/square/okhttp/events","assignees_url":"https://api.github.com/repos/square/okhttp/assignees{/user}","branches_url":"https://api.github.com/repos/square/okhttp/branches{/branch}","tags_url":"https://api.github.com/repos/square/okhttp/tags","blobs_url":"https://api.github.com/repos/square/okhttp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/okhttp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/okhttp/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/okhttp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/okhttp/statuses/{sha}","languages_url":"https://api.github.com/repos/square/okhttp/languages","stargazers_url":"https://api.github.com/repos/square/okhttp/stargazers","contributors_url":"https://api.github.com/repos/square/okhttp/contributors","subscribers_url":"https://api.github.com/repos/square/okhttp/subscribers","subscription_url":"https://api.github.com/repos/square/okhttp/subscription","commits_url":"https://api.github.com/repos/square/okhttp/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/okhttp/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/okhttp/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/okhttp/issues/comments{/number}","contents_url":"https://api.github.com/repos/square/okhttp/contents/{+path}","compare_url":"https://api.github.com/repos/square/okhttp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/okhttp/merges","archive_url":"https://api.github.com/repos/square/okhttp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/okhttp/downloads","issues_url":"https://api.github.com/repos/square/okhttp/issues{/number}","pulls_url":"https://api.github.com/repos/square/okhttp/pulls{/number}","milestones_url":"https://api.github.com/repos/square/okhttp/milestones{/number}","notifications_url":"https://api.github.com/repos/square/okhttp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/okhttp/labels{/name}","releases_url":"https://api.github.com/repos/square/okhttp/releases{/id}","created_at":"2012-07-23T13:42:55Z","updated_at":"2015-11-28T14:24:41Z","pushed_at":"2015-11-28T05:29:54Z","git_url":"git://github.com/square/okhttp.git","ssh_url":"git@github.com:square/okhttp.git","clone_url":"https://github.com/square/okhttp.git","svn_url":"https://github.com/square/okhttp","homepage":"http://square.github.io/okhttp/","size":12521,"stargazers_count":7406,"watchers_count":7406,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1819,"mirror_url":null,"open_issues_count":107,"forks":1819,"open_issues":107,"watchers":7406,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/square/okhttp/pulls/2045"},"html":{"href":"https://github.com/square/okhttp/pull/2045"},"issue":{"href":"https://api.github.com/repos/square/okhttp/issues/2045"},"comments":{"href":"https://api.github.com/repos/square/okhttp/issues/2045/comments"},"review_comments":{"href":"https://api.github.com/repos/square/okhttp/pulls/2045/comments"},"review_comment":{"href":"https://api.github.com/repos/square/okhttp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/square/okhttp/pulls/2045/commits"},"statuses":{"href":"https://api.github.com/repos/square/okhttp/statuses/afc415362addd89ee1eeba7bf690dc27d310a19d"}}}}