3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-02-18 06:30:39 +01:00

remove server command mutex

This commit is contained in:
Jeremy Latt 2014-02-13 20:58:13 -08:00
parent 7cef494d28
commit 3ba928cee6

View File

@ -9,7 +9,6 @@ import (
"log" "log"
"net" "net"
"os" "os"
"sync"
"time" "time"
) )
@ -18,7 +17,6 @@ type Server struct {
commands chan Command commands chan Command
ctime time.Time ctime time.Time
motdFile string motdFile string
mutex *sync.Mutex
name string name string
operators map[string]string operators map[string]string
password string password string
@ -32,7 +30,6 @@ func NewServer(config *Config) *Server {
commands: make(chan Command), commands: make(chan Command),
ctime: time.Now(), ctime: time.Now(),
motdFile: config.MOTD, motdFile: config.MOTD,
mutex: &sync.Mutex{},
name: config.Name, name: config.Name,
operators: make(map[string]string), operators: make(map[string]string),
password: config.Password, password: config.Password,
@ -69,9 +66,7 @@ func (server *Server) receiveCommands() {
} }
func (server *Server) Command(command Command) { func (server *Server) Command(command Command) {
server.mutex.Lock()
server.commands <- command server.commands <- command
server.mutex.Unlock()
} }
func (server *Server) Authorize(client *Client, command Command) bool { func (server *Server) Authorize(client *Client, command Command) bool {