KevinMGranger / go9p

Automatically exported from code.google.com/p/go9p
Other
0 stars 0 forks source link

Unregistreing a http handler #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The code which unregisters the http handler:

func (srv *Srv) statsRegister() {
        http.Handle("/go9p/srv/"+srv.Id, srv)
}

func (srv *Srv) statsUnregister() {
        http.Handle("/go9p/srv/"+srv.Id, nil)
}

Breaks with weekly 2012-03-22:

panic: http: nil handler

goroutine 6 [running]:
net/http.(*ServeMux).Handle(0xf840059900, 0xf8400ac090, 0x22, 0x0, 0x0, ...)
    /usr/lib/go/src/pkg/net/http/server.go:937 +0x101
net/http.Handle(0xf8400ac090, 0x100000022, 0x0, 0x0, 0x73667500000003, ...)
    /usr/lib/go/src/pkg/net/http/server.go:962 +0x52
code.google.com/p/go9p/p/srv.(*Conn).statsUnregister(0xf8400c0000, 0x5c0798)
    /home/marko/gocode/src/code.google.com/p/go9p/p/srv/stats_http.go:40 +0x89
code.google.com/p/go9p/p/srv.(*Conn).recv(0xf8400c0000, 0x0)
    /home/marko/gocode/src/code.google.com/p/go9p/p/srv/conn.go:155 +0x4ce
created by code.google.com/p/go9p/p/srv.(*Srv).NewConn
    /home/marko/gocode/src/code.google.com/p/go9p/p/srv/conn.go:42 +0x28f

Original issue reported on code.google.com by mmikuli...@gmail.com on 24 Mar 2012 at 5:36

GoogleCodeExporter commented 9 years ago
fixed with latest push. 

Original comment by mirtchov...@gmail.com on 27 Mar 2012 at 4:54