When locking *do* unlock

Add unlocking to some more places as pointed out by bronze1man.

Really closes #161.
This commit is contained in:
Miek Gieben 2015-01-13 08:12:02 +00:00
parent a07be6b2c1
commit 2b6f0d61e5
1 changed files with 2 additions and 0 deletions

View File

@ -287,6 +287,7 @@ func (srv *Server) ListenAndServe() error {
func (srv *Server) ActivateAndServe() error {
srv.lock.Lock()
if srv.started {
srv.lock.Unlock()
return &Error{err: "server already started"}
}
srv.stopUDP, srv.stopTCP = make(chan bool), make(chan bool)
@ -318,6 +319,7 @@ func (srv *Server) ActivateAndServe() error {
func (srv *Server) Shutdown() error {
srv.lock.Lock()
if !srv.started {
srv.lock.Unlock()
return &Error{err: "server not started"}
}
srv.started = false