Move swappableMux and its methods to its own module
This commit is contained in:
@@ -2,29 +2,8 @@ package user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
type swappableMux struct {
|
||||
m sync.RWMutex
|
||||
root mux.Router
|
||||
}
|
||||
|
||||
func (sm *swappableMux) get() mux.Router {
|
||||
sm.m.RLock()
|
||||
defer sm.m.RUnlock()
|
||||
|
||||
return sm.root
|
||||
}
|
||||
|
||||
func (sm *swappableMux) set(mux mux.Router) {
|
||||
sm.m.Lock()
|
||||
sm.root = mux
|
||||
sm.m.Unlock()
|
||||
}
|
||||
|
||||
var Server http.Server
|
||||
|
||||
func Run() {
|
||||
|
||||
Reference in New Issue
Block a user