Merge branch 'master' into vtrace
diff --git a/options/.api b/options/.api
index fec4c48..05d88ab 100644
--- a/options/.api
+++ b/options/.api
@@ -1,6 +1,7 @@
 pkg options, method (ChannelTimeout) RPCCallOpt()
 pkg options, method (ChannelTimeout) RPCServerOpt()
 pkg options, method (IsLeaf) RPCServerOpt()
+pkg options, method (LameDuckTimeout) RPCServerOpt()
 pkg options, method (NameResolutionAuthorizer) NSOpt()
 pkg options, method (NameResolutionAuthorizer) RPCCallOpt()
 pkg options, method (NoRetry) NSOpt()
@@ -13,6 +14,7 @@
 pkg options, method (ServesMountTable) RPCServerOpt()
 pkg options, type ChannelTimeout time.Duration
 pkg options, type IsLeaf bool
+pkg options, type LameDuckTimeout time.Duration
 pkg options, type NameResolutionAuthorizer struct
 pkg options, type NameResolutionAuthorizer struct, embedded security.Authorizer
 pkg options, type NoRetry struct
diff --git a/options/options.go b/options/options.go
index fcee51a..be8219d 100644
--- a/options/options.go
+++ b/options/options.go
@@ -120,6 +120,11 @@
 
 func (ServesMountTable) RPCServerOpt() {}
 
+// LameDuckTimeout specifies the time to wait for all server operations to complete after Stop is called.
+type LameDuckTimeout time.Duration
+
+func (LameDuckTimeout) RPCServerOpt() {}
+
 // Create a server that will be used to serve a leaf service.
 type IsLeaf bool
 
diff --git a/rpc/.api b/rpc/.api
index d2b6325..5e36f82 100644
--- a/rpc/.api
+++ b/rpc/.api
@@ -8,10 +8,6 @@
 pkg rpc, func NewGlobState(interface{}) *GlobState
 pkg rpc, func ReflectInvoker(interface{}) (Invoker, error)
 pkg rpc, func ReflectInvokerOrDie(interface{}) Invoker
-pkg rpc, func RegisterProtocol(string, DialerFunc, ResolverFunc, ListenerFunc, ...string) bool
-pkg rpc, func RegisterUnknownProtocol(string, DialerFunc, ResolverFunc, ListenerFunc) bool
-pkg rpc, func RegisteredProtocol(string) (DialerFunc, ResolverFunc, ListenerFunc, []string)
-pkg rpc, func RegisteredProtocols() []string
 pkg rpc, func TypeCheckMethods(interface{}) map[string]error
 pkg rpc, method (AddressChooserFunc) ChooseAddresses(string, []net.Addr) ([]net.Addr, error)
 pkg rpc, method (ListenSpec) Copy() ListenSpec
@@ -48,7 +44,6 @@
 pkg rpc, type ClientOpt interface, RPCClientOpt()
 pkg rpc, type Describer interface { Describe__ }
 pkg rpc, type Describer interface, Describe__() []InterfaceDesc
-pkg rpc, type DialerFunc func(ctx *context.T, protocol, address string, timeout time.Duration) (net.Conn, error)
 pkg rpc, type Dispatcher interface { Lookup }
 pkg rpc, type Dispatcher interface, Lookup(*context.T, string) (interface{}, security.Authorizer, error)
 pkg rpc, type EmbedDesc struct
@@ -96,7 +91,6 @@
 pkg rpc, type ListenSpec struct, Addrs ListenAddrs
 pkg rpc, type ListenSpec struct, Proxy string
 pkg rpc, type ListenSpec struct, embedded AddressChooser
-pkg rpc, type ListenerFunc func(ctx *context.T, protocol, address string) (net.Listener, error)
 pkg rpc, type MethodDesc struct
 pkg rpc, type MethodDesc struct, Doc string
 pkg rpc, type MethodDesc struct, InArgs []ArgDesc
@@ -123,7 +117,6 @@
 pkg rpc, type Request struct, NumPosArgs uint64
 pkg rpc, type Request struct, Suffix string
 pkg rpc, type Request struct, TraceRequest vtrace.Request
-pkg rpc, type ResolverFunc func(ctx *context.T, protocol, address string) (string, string, error)
 pkg rpc, type Response struct
 pkg rpc, type Response struct, AckBlessings bool
 pkg rpc, type Response struct, EndStreamResults bool
diff --git a/rpc/registry.go b/rpc/registry.go
deleted file mode 100644
index 2dd9d35..0000000
--- a/rpc/registry.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package rpc
-
-import (
-	"fmt"
-	"net"
-	"sync"
-	"time"
-
-	"v.io/v23/context"
-	"v.io/v23/naming"
-)
-
-// This file is DEPRECATED. If you wish to add new protocols please you the
-// v23/flow.RegisterProtocol methods.
-// TODO(suharshs): Remove this file and corresponding protocols once the transition
-// to the new rpc implementation is complete.
-
-// DialerFunc is the function used to create net.Conn objects given a
-// protocol-specific string representation of an address.
-type DialerFunc func(ctx *context.T, protocol, address string, timeout time.Duration) (net.Conn, error)
-
-// ResolverFunc is the function used for protocol-specific address normalization.
-// e.g. the TCP resolve performs DNS resolution.
-type ResolverFunc func(ctx *context.T, protocol, address string) (string, string, error)
-
-// ListenerFunc is the function used to create net.Listener objects given a
-// protocol-specific string representation of the address a server will listen on.
-type ListenerFunc func(ctx *context.T, protocol, address string) (net.Listener, error)
-
-// RegisterProtocol makes available a Dialer, Resolver, and Listener to RegisteredNetwork.
-// If the protocol represents other actual protocols, you need to specify all the
-// actual protocols. E.g, "wsh" represents "tcp4", "tcp6", "ws4", and "ws6".
-//
-// Implementations of the Manager interface are expected to use this registry
-// in order to expand the reach of the types of network protocols they can
-// handle.
-//
-// Successive calls to RegisterProtocol replace the contents of a previous
-// call to it and returns trues if a previous value was replaced, false otherwise.
-func RegisterProtocol(protocol string, dialer DialerFunc, resolver ResolverFunc, listener ListenerFunc, p ...string) bool {
-	// This is for handling the common case where protocol is a "singleton", to
-	// make it easier to specify.
-	if len(p) == 0 {
-		p = []string{protocol}
-	}
-	registryLock.Lock()
-	defer registryLock.Unlock()
-	_, present := registry[protocol]
-	registry[protocol] = registryEntry{dialer, resolver, listener, p}
-	return present
-}
-
-// RegisterUnknownProtocol registers a Dialer, Resolver, and Listener for endpoints with
-// no specified protocol.
-//
-// The desired protocol provided in the first argument will be passed to the
-// Dialer and Listener as the actual protocol to use when dialing or listening.
-//
-// The protocol itself must have already been registered before RegisterUnknownProtocol
-// is called, otherwise we'll panic.
-func RegisterUnknownProtocol(protocol string, dialer DialerFunc, resolver ResolverFunc, listener ListenerFunc) bool {
-	var p []string
-	registryLock.RLock()
-	r, present := registry[protocol]
-	if !present {
-		panic(fmt.Sprintf("%s not registered", protocol))
-	}
-	p = r.p
-	registryLock.RUnlock()
-	wrappedDialer := func(ctx *context.T, _, address string, timeout time.Duration) (net.Conn, error) {
-		return dialer(ctx, protocol, address, timeout)
-	}
-	wrappedResolver := func(ctx *context.T, _, address string) (string, string, error) {
-		return resolver(ctx, protocol, address)
-	}
-	wrappedListener := func(ctx *context.T, _, address string) (net.Listener, error) {
-		return listener(ctx, protocol, address)
-	}
-	return RegisterProtocol(naming.UnknownProtocol, wrappedDialer, wrappedResolver, wrappedListener, p...)
-}
-
-// RegisteredProtocol returns the Dialer, Resolver, and Listener registered with a
-// previous call to RegisterProtocol.
-func RegisteredProtocol(protocol string) (DialerFunc, ResolverFunc, ListenerFunc, []string) {
-	registryLock.RLock()
-	e := registry[protocol]
-	registryLock.RUnlock()
-	return e.d, e.r, e.l, e.p
-}
-
-// RegisteredProtocols returns the list of protocols that have been previously
-// registered using RegisterProtocol. The underlying implementation will
-// support additional protocols such as those supported by the native RPC stack.
-func RegisteredProtocols() []string {
-	registryLock.RLock()
-	defer registryLock.RUnlock()
-	p := make([]string, 0, len(registry))
-	for k, _ := range registry {
-		p = append(p, k)
-	}
-	return p
-}
-
-type registryEntry struct {
-	d DialerFunc
-	r ResolverFunc
-	l ListenerFunc
-	p []string
-}
-
-var (
-	registryLock sync.RWMutex
-	registry     = make(map[string]registryEntry)
-)
diff --git a/security/ecdsa_go.go b/security/ecdsa_go.go
index 30ed8d8..bff1875 100644
--- a/security/ecdsa_go.go
+++ b/security/ecdsa_go.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !cgo noopenssl !linux,!openssl android !amd64,!openssl
+// +build go1.6 !cgo noopenssl !linux,!openssl android !amd64,!openssl
 
 // See comments in ecdsa_openssl.go for an explanation of the choice of
 // build tags.
diff --git a/security/ecdsa_openssl.go b/security/ecdsa_openssl.go
index e2914bc..e9573d7 100644
--- a/security/ecdsa_openssl.go
+++ b/security/ecdsa_openssl.go
@@ -2,21 +2,23 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !android,linux,amd64,cgo,!noopenssl openssl,cgo
+// +build !go1.6,!android,linux,amd64,cgo,!noopenssl openssl,cgo
 
 // The purpose of this file is to improve performance, as demonstrated by
 // benchmarks when linked against openssl-1.0.1f (with further improvements in
 // openssl-1.0.2, at the time this comment was written).
 //   go test -bench ECDSA v.io/v23/security
 //
-// See https://go-review.googlesource.com/#/c/8968/ for why the Go standard
-// library (as of Go 1.5) does not have performance on par with OpenSSL.
+// With Go 1.6, the Go standard library will have performance on-par with
+// OpenSSL for amd64 (see https://go-review.googlesource.com/#/c/8968/).
+// Prior to that however, using OpenSSL (via cgo) provides a significant
+// performance improvement.
 //
 // By default (without an explicit build tag), this is disabled for darwin
 // since OpenSSL has been marked deprecated on OS X since version 10.7.  The
 // last openssl release on OS X was version 0.9.8 and compiling this file will
 // show these deprecation warnings.  Those sensitive to performance are
-// encouraged to compile a later version of OpenSSL and set the build tag.
+// encouraged to move to Go 1.6.
 //
 // Currently, this file is disabled for linux/arm as a temporary hack.  In
 // practice, linux/arm binaries are often cross-compiled on a linux/amd64 host.
diff --git a/security/ecdsa_openssl_test.go b/security/ecdsa_openssl_test.go
index 70408f6..cba249b 100644
--- a/security/ecdsa_openssl_test.go
+++ b/security/ecdsa_openssl_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !android,linux,amd64,cgo,!noopenssl openssl,cgo
+// +build !go1.6,!android,linux,amd64,cgo,!noopenssl openssl,cgo
 
 package security
 
diff --git a/syncbase/featuretests/cr_v23_test.go b/syncbase/featuretests/cr_v23_test.go
index e5613f0..b7f84b1 100644
--- a/syncbase/featuretests/cr_v23_test.go
+++ b/syncbase/featuretests/cr_v23_test.go
@@ -33,6 +33,10 @@
 // TODO(jlodhia): Add more rules based on value type and combination of key
 // prefix and value type once its implemented.
 func TestV23CRRuleConfig(t *testing.T) {
+	// TODO(jlodhia): Re-enable test after following issue is resolved.
+	// https://github.com/vanadium/issues/issues/1027
+	t.Skip()
+
 	v23test.SkipUnlessRunningIntegrationTests(t)
 	sh := v23test.NewShell(t, v23test.Opts{})
 	defer sh.Cleanup()
@@ -153,6 +157,10 @@
 // 2) 5 rows written as a single batch on both syncbases resulting into a
 //    single conflict for the batch.
 func TestV23CRAppResolved(t *testing.T) {
+	// TODO(jlodhia): Re-enable test after following issue is resolved.
+	// https://github.com/vanadium/issues/issues/1027
+	t.Skip()
+
 	v23test.SkipUnlessRunningIntegrationTests(t)
 	sh := v23test.NewShell(t, v23test.Opts{})
 	defer sh.Cleanup()