Reworked connection to use a single thread for state management.

Also disabled the SetConnection API call.

Stream cleanup.

Removed Unnescessary threads, there is now one thread per connection (handling response stream forwarding), and the existing thread is used to forward the request stream.
Renamed 'streams' to 'request'.
Renamed 'nbFrame' to 'requestFrame'.
Renamed 'sbFrame' to 'responseFrame'.

Changed handling of streaming requests.

Incoming & Outgoing streams are split when a connection becomes ready.
Added playback of non-streaming requests/responses for newly opened streams.

Late stream catchup fix & streaming call detection.

Fixed an issue where old streams were not being caught up with what they missed.
Streaming requests & responses are now detected based on the proto definitions.
Changed where the proto file is specified in the afrouter config (see afrouter/arouter.json for an example).

Fixed mutex copy.

Also tweaked some log statements.

Fixed field tag lint error.

Change-Id: I6e14039c27519d8d2103065258ff4302bc881235
diff --git a/afrouter/afrouter/api.go b/afrouter/afrouter/api.go
index 87f5573..3e47ef8 100644
--- a/afrouter/afrouter/api.go
+++ b/afrouter/afrouter/api.go
@@ -24,6 +24,7 @@
 	"golang.org/x/net/context"
 	"google.golang.org/grpc"
 	"net"
+	"net/url"
 	"runtime"
 	"strconv"
 )
@@ -41,7 +42,7 @@
 	var rtrn_err bool
 	// Create a seperate server and listener for the API
 	// Validate the ip address if one is provided
-	if ip := net.ParseIP(config.Addr); config.Addr != "" && ip == nil {
+	if _, err := url.Parse(config.Addr); err != nil {
 		log.Errorf("Invalid address '%s' provided for API server", config.Addr)
 		rtrn_err = true
 	}
@@ -118,17 +119,7 @@
 }
 
 func (aa *ArouterApi) updateConnection(in *pb.Conn, cn *connection, b *backend) error {
-	sPort := strconv.FormatUint(in.Port, 10)
-	// Check that the ip address and or port are different
-	if in.Addr == cn.addr && sPort == cn.port {
-		err := errors.New(fmt.Sprintf("Refusing to change connection '%s' to identical values", in.Connection))
-		return err
-	}
-	cn.close()
-	cn.addr = in.Addr
-	cn.port = sPort
-	cn.connect()
-	return nil
+	return errors.New("updateConnection not implemented")
 }
 
 func (aa ArouterApi) SetAffinity(ctx context.Context, in *pb.Affinity) (*pb.Result, error) {