Make initial service config non-blocking in Dial()

This commit is contained in:
Yuxuan Li 2017-04-05 11:08:50 -07:00
parent ad16b942fb
commit a66f9231a8
2 changed files with 7 additions and 8 deletions

View File

@ -356,14 +356,13 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
}()
if cc.dopts.scChan != nil {
// Wait for the initial service config.
// Try to get an initial service config.
select {
case sc, ok := <-cc.dopts.scChan:
if ok {
cc.sc = sc
}
case <-ctx.Done():
return nil, ctx.Err()
default:
}
}
// Set defaults.

View File

@ -1450,12 +1450,12 @@ func testServiceConfigMaxMsgSize(t *testing.T, e env) {
wg.Wait()
}
func TestMsgSizeDefaultAndApi(t *testing.T) {
func TestMsgSizeDefaultAndAPI(t *testing.T) {
defer leakCheck(t)()
for _, e := range listTestEnv() {
testMaxMsgSizeClientDefault(t, e)
testMaxMsgSizeClientApi(t, e)
testMaxMsgSizeServerApi(t, e)
testMaxMsgSizeClientAPI(t, e)
testMaxMsgSizeServerAPI(t, e)
}
}
@ -1538,7 +1538,7 @@ func testMaxMsgSizeClientDefault(t *testing.T, e env) {
}
}
func testMaxMsgSizeClientApi(t *testing.T, e env) {
func testMaxMsgSizeClientAPI(t *testing.T, e env) {
te := newTest(t, e)
te.userAgent = testAppUA
// To avoid error on server side.
@ -1619,7 +1619,7 @@ func testMaxMsgSizeClientApi(t *testing.T, e env) {
}
}
func testMaxMsgSizeServerApi(t *testing.T, e env) {
func testMaxMsgSizeServerAPI(t *testing.T, e env) {
te := newTest(t, e)
te.userAgent = testAppUA
te.maxServerReceiveMsgSize = 1024