mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
don't buffer channels (except signal channel)
This commit is contained in:
parent
4268c4a936
commit
d1a299792e
@ -16,6 +16,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
SERVER_SIGNALS = []os.Signal{syscall.SIGINT, syscall.SIGHUP,
|
||||||
|
syscall.SIGTERM, syscall.SIGQUIT}
|
||||||
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
channels ChannelNameMap
|
channels ChannelNameMap
|
||||||
clients *ClientLookupSet
|
clients *ClientLookupSet
|
||||||
@ -36,15 +41,15 @@ func NewServer(config *Config) *Server {
|
|||||||
server := &Server{
|
server := &Server{
|
||||||
channels: make(ChannelNameMap),
|
channels: make(ChannelNameMap),
|
||||||
clients: NewClientLookupSet(),
|
clients: NewClientLookupSet(),
|
||||||
commands: make(chan Command, 16),
|
commands: make(chan Command),
|
||||||
ctime: time.Now(),
|
ctime: time.Now(),
|
||||||
db: OpenDB(config.Server.Database),
|
db: OpenDB(config.Server.Database),
|
||||||
idle: make(chan *Client, 16),
|
idle: make(chan *Client),
|
||||||
motdFile: config.Server.MOTD,
|
motdFile: config.Server.MOTD,
|
||||||
name: config.Server.Name,
|
name: config.Server.Name,
|
||||||
newConns: make(chan net.Conn, 16),
|
newConns: make(chan net.Conn),
|
||||||
operators: config.Operators(),
|
operators: config.Operators(),
|
||||||
signals: make(chan os.Signal, 1),
|
signals: make(chan os.Signal, len(SERVER_SIGNALS)),
|
||||||
whoWas: NewWhoWasList(100),
|
whoWas: NewWhoWasList(100),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +63,7 @@ func NewServer(config *Config) *Server {
|
|||||||
go server.listen(addr)
|
go server.listen(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
signal.Notify(server.signals, syscall.SIGINT, syscall.SIGHUP,
|
signal.Notify(server.signals, SERVER_SIGNALS...)
|
||||||
syscall.SIGTERM, syscall.SIGQUIT)
|
|
||||||
|
|
||||||
return server
|
return server
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user