Browse Source

Don't expose the internal routeMachine

Carl Jackson 11 years ago
parent
commit
04b25f26e5
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      web/router.go

+ 6
- 2
web/router.go View File

@ -230,7 +230,11 @@ func (rm routeMachine) route(c *C, w http.ResponseWriter, r *http.Request) (meth
// after all the routes have been added, and will be called automatically for
// you (at some performance cost on the first request) if you do not call it
// explicitly.
func (rt *router) Compile() *routeMachine {
func (rt *router) Compile() {
rt.compile()
}
func (rt *router) compile() *routeMachine {
rt.lock.Lock()
defer rt.lock.Unlock()
sm := routeMachine{
@ -244,7 +248,7 @@ func (rt *router) Compile() *routeMachine {
func (rt *router) route(c *C, w http.ResponseWriter, r *http.Request) {
rm := rt.getMachine()
if rm == nil {
rm = rt.Compile()
rm = rt.compile()
}
methods, ok := rm.route(c, w, r)


Loading…
Cancel
Save