Loading core/java/android/net/NetworkAgent.java +29 −17 Original line number Diff line number Diff line Loading @@ -257,17 +257,19 @@ public abstract class NetworkAgent extends Handler { } /** * called to go through our list of requests and see if we're * good enough to try connecting. * Called to go through our list of requests and see if we're * good enough to try connecting, or if we have gotten worse and * need to disconnect. * * Only does connects - we disconnect when requested via * Once we are registered, does nothing: we disconnect when requested via * CMD_CHANNEL_DISCONNECTED, generated by either a loss of connection * between modules (bearer or ConnectivityService dies) or more commonly * when the NetworkInfo reports to ConnectivityService it is disconnected. */ private void evalScores() { if (mConnectionRequested) { if (VDBG) log("evalScores - already trying - size=" + mNetworkRequests.size()); synchronized(mLockObj) { if (mRegistered) { if (VDBG) log("evalScores - already connected - size=" + mNetworkRequests.size()); // already trying return; } Loading @@ -277,12 +279,22 @@ public abstract class NetworkAgent extends Handler { if (VDBG) log(" checking request Min " + score + " vs my score " + mNetworkScore); if (score < mNetworkScore) { // have a request that has a lower scored network servicing it // (or no network) than we could provide, so lets connect! // (or no network) than we could provide, so let's connect! mConnectionRequested = true; connect(); return; } } // Our score is not high enough to satisfy any current request. // This can happen if our score goes down after a connection is // requested but before we actually connect. In this case, disconnect // rather than continue trying - there's no point connecting if we know // we'll just be torn down as soon as we do. if (mConnectionRequested) { mConnectionRequested = false; disconnect(); } } } public void addNetworkRequest(NetworkRequest networkRequest, int score) { Loading Loading
core/java/android/net/NetworkAgent.java +29 −17 Original line number Diff line number Diff line Loading @@ -257,17 +257,19 @@ public abstract class NetworkAgent extends Handler { } /** * called to go through our list of requests and see if we're * good enough to try connecting. * Called to go through our list of requests and see if we're * good enough to try connecting, or if we have gotten worse and * need to disconnect. * * Only does connects - we disconnect when requested via * Once we are registered, does nothing: we disconnect when requested via * CMD_CHANNEL_DISCONNECTED, generated by either a loss of connection * between modules (bearer or ConnectivityService dies) or more commonly * when the NetworkInfo reports to ConnectivityService it is disconnected. */ private void evalScores() { if (mConnectionRequested) { if (VDBG) log("evalScores - already trying - size=" + mNetworkRequests.size()); synchronized(mLockObj) { if (mRegistered) { if (VDBG) log("evalScores - already connected - size=" + mNetworkRequests.size()); // already trying return; } Loading @@ -277,12 +279,22 @@ public abstract class NetworkAgent extends Handler { if (VDBG) log(" checking request Min " + score + " vs my score " + mNetworkScore); if (score < mNetworkScore) { // have a request that has a lower scored network servicing it // (or no network) than we could provide, so lets connect! // (or no network) than we could provide, so let's connect! mConnectionRequested = true; connect(); return; } } // Our score is not high enough to satisfy any current request. // This can happen if our score goes down after a connection is // requested but before we actually connect. In this case, disconnect // rather than continue trying - there's no point connecting if we know // we'll just be torn down as soon as we do. if (mConnectionRequested) { mConnectionRequested = false; disconnect(); } } } public void addNetworkRequest(NetworkRequest networkRequest, int score) { Loading