grpc-java icon indicating copy to clipboard operation
grpc-java copied to clipboard

Observe MAX_CONCURRENT_STREAMS in OkHttp client

Open ejona86 opened this issue 11 years ago • 10 comments

We ignore it. We shouldn't.

ejona86 avatar Mar 11 '15 17:03 ejona86

Do you want me to pick this up?

madongfly avatar Mar 31 '15 12:03 madongfly

Sure.

ejona86 avatar Mar 31 '15 15:03 ejona86

In order to do this, we need the access to Settings, either wait for OkHttp's change, https://github.com/square/okhttp/issues/32, or we just hack it by adding a class in our code base but in package com.squareup.okhttp.internal.spdy, if we go the later way, I'm worrying about the difficulty of sync with our internal version.

madongfly avatar Apr 02 '15 06:04 madongfly

@madongfly, no, that OkHttp issue is about something different that isn't part of the HTTP/2 spec any more.

We need to remember the MAX_CONCURRENT_STREAMS at OkHttpClientTransport.settings and make sure not to exceed the number of streams in OkHttpClientTransport.newStream.

ejona86 avatar Apr 02 '15 16:04 ejona86

@ejona86, I meant the general idea of "Better support for SETTINGS", currently we can't config/read the Settings.

madongfly avatar Apr 03 '15 00:04 madongfly

@madongfly, that OkHttp issue is for making SETTINGS durable. That is, to save them on disk like is done with cookies and caches. That feature is no longer part of the HTTP/2 spec and so is no longer appropriate for discussion.

We can receive the settings when the server sends them, in OkHttpClientTransport.settings(), which I linked to. Why do you think we can't config/read the settings?

ejona86 avatar Apr 03 '15 01:04 ejona86

Because the necessary field/methods are package private.

On Fri, Apr 3, 2015 at 9:08 AM, Eric Anderson [email protected] wrote:

@madongfly https://github.com/madongfly, that OkHttp issue is for making SETTINGS durable. That is, to save them on disk like is done with cookies and caches. That feature is no longer part of the HTTP/2 spec and so is no longer appropriate for discussion.

We can receive the settings when the server sends them, in OkHttpClientTransport.settings(), which I linked to. Why do you think we can't config/read the settings?

— Reply to this email directly or view it on GitHub https://github.com/grpc/grpc-java/issues/181#issuecomment-89103091.

madongfly avatar Apr 03 '15 01:04 madongfly

Ah, I see. Yeah, I don't think we're going to get that changed. We should create a utility class in the appropriate package and call it to get the information we need:

package com.squareup.okhttp.internal.spdy;

public class MakeItPublicUtility {
  public static final int MAX_CONCURRENT_STREAMS = Settings.MAX_CONCURRENT_STREAMS;
  public static boolean isSet(Settings settings, int id) {
    return settings.isSet(id);
  }
  public static int get(Settings settings, int id) {
    return settings.get(id);
  }
}

ejona86 avatar Apr 03 '15 01:04 ejona86

Yeah, that's the 2nd option I mentioned, we can go this way.

madongfly avatar Apr 03 '15 01:04 madongfly

This was fixed by #269

madongfly avatar Apr 07 '15 07:04 madongfly