|
|
|
@ -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) |
|
|
|
|