Bug 1337791 - Part 1: JoinConnection() from psm. r=keeler

This commit is contained in:
Patrick McManus 2017-04-03 17:23:09 -04:00
parent a1f2e12af8
commit 58fc1b834e
2 changed files with 26 additions and 9 deletions

View File

@ -62,10 +62,18 @@ interface nsISSLSocketControl : nsISupports {
/* Determine if a potential SSL connection to hostname:port with
* a desired NPN negotiated protocol of npnProtocol can use the socket
* associated with this object instead of making a new one.
* associated with this object instead of making a new one. And if so, combine
* them.
*/
boolean joinConnection(
in ACString npnProtocol, /* e.g. "spdy/2" */
in ACString npnProtocol, /* e.g. "h2" */
in ACString hostname,
in long port);
/* just like JoinConnection() except do not mark a successful test as joined.
*/
boolean testJoinConnection(
in ACString npnProtocol, /* e.g. "h2" */
in ACString hostname,
in long port);

View File

@ -473,7 +473,7 @@ nsNSSSocketInfo::IsAcceptableForHost(const nsACString& hostname, bool* _retval)
}
NS_IMETHODIMP
nsNSSSocketInfo::JoinConnection(const nsACString& npnProtocol,
nsNSSSocketInfo::TestJoinConnection(const nsACString& npnProtocol,
const nsACString& hostname,
int32_t port,
bool* _retval)
@ -494,13 +494,22 @@ nsNSSSocketInfo::JoinConnection(const nsACString& npnProtocol,
return NS_OK;
}
IsAcceptableForHost(hostname, _retval);
IsAcceptableForHost(hostname, _retval); // sets _retval
return NS_OK;
}
if (*_retval) {
NS_IMETHODIMP
nsNSSSocketInfo::JoinConnection(const nsACString& npnProtocol,
const nsACString& hostname,
int32_t port,
bool* _retval)
{
nsresult rv = TestJoinConnection(npnProtocol, hostname, port, _retval);
if (NS_SUCCEEDED(rv) && *_retval) {
// All tests pass - this is joinable
mJoined = true;
}
return NS_OK;
return rv;
}
bool