rpc: expose Server type to allow multiple RPC Server instances

R=r, rsc, msolo, sougou
CC=golang-dev
https://golang.org/cl/2696041
This commit is contained in:
Andrew Gerrand 2010-10-28 11:05:56 +11:00
parent 904adfdc46
commit 250ac87368
4 changed files with 152 additions and 63 deletions

View file

@ -61,8 +61,12 @@ func (m methodArray) Len() int { return len(m) }
func (m methodArray) Less(i, j int) bool { return m[i].name < m[j].name }
func (m methodArray) Swap(i, j int) { m[i], m[j] = m[j], m[i] }
type debugHTTP struct {
*Server
}
// Runs at /debug/rpc
func debugHTTP(w http.ResponseWriter, req *http.Request) {
func (server debugHTTP) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// Build a sorted version of the data.
var services = make(serviceArray, len(server.serviceMap))
i := 0