RPC: Fix bug in the RPC system where it's possible that nobody every
creates a type flow for a connection.

Change-Id: Ic348dc9b13c3e32077ce20ce69c02c195b232122
diff --git a/runtime/internal/rpc/client.go b/runtime/internal/rpc/client.go
index 1ce9bca..2c9220b 100644
--- a/runtime/internal/rpc/client.go
+++ b/runtime/internal/rpc/client.go
@@ -449,23 +449,23 @@
 			status.serverErr = suberr(err)
 			return
 		}
-		if write := c.typeCache.writer(flw.Conn()); write != nil {
-			// Create the type flow with a root-cancellable context.
-			// This flow must outlive the flow we're currently creating.
-			// It lives as long as the connection to which it is bound.
-			tctx, tcancel := context.WithRootCancel(ctx)
-			tflow, err := c.flowMgr.DialSideChannel(tctx, flw.RemoteEndpoint(), typeFlowAuthorizer{}, 0)
-			if err != nil {
-				write(nil, tcancel)
-			} else if tflow.Conn() != flw.Conn() {
-				tflow.Close()
-				write(nil, tcancel)
-			} else if _, err = tflow.Write([]byte{typeFlow}); err != nil {
-				tflow.Close()
-				write(nil, tcancel)
-			} else {
-				write(tflow, tcancel)
-			}
+	}
+	if write := c.typeCache.writer(flw.Conn()); write != nil {
+		// Create the type flow with a root-cancellable context.
+		// This flow must outlive the flow we're currently creating.
+		// It lives as long as the connection to which it is bound.
+		tctx, tcancel := context.WithRootCancel(ctx)
+		tflow, err := c.flowMgr.DialSideChannel(tctx, flw.RemoteEndpoint(), typeFlowAuthorizer{}, 0)
+		if err != nil {
+			write(nil, tcancel)
+		} else if tflow.Conn() != flw.Conn() {
+			tflow.Close()
+			write(nil, tcancel)
+		} else if _, err = tflow.Write([]byte{typeFlow}); err != nil {
+			tflow.Close()
+			write(nil, tcancel)
+		} else {
+			write(tflow, tcancel)
 		}
 	}