3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

Make channels synchronous.

This commit is contained in:
Jeremy Latt 2013-06-02 16:53:06 -07:00
parent 74aaf2f9d3
commit 0001131095
5 changed files with 7 additions and 7 deletions

View File

@ -49,8 +49,8 @@ type ChannelCommand interface {
// NewChannel creates a new channel from a `Server` and a `name` string, which // NewChannel creates a new channel from a `Server` and a `name` string, which
// must be unique on the server. // must be unique on the server.
func NewChannel(s *Server, name string) *Channel { func NewChannel(s *Server, name string) *Channel {
commands := make(chan ChannelCommand, 1) commands := make(chan ChannelCommand)
replies := make(chan Reply, 1) replies := make(chan Reply)
channel := &Channel{ channel := &Channel{
name: name, name: name,
members: make(UserSet), members: make(UserSet),

View File

@ -31,7 +31,7 @@ type ClientSet map[*Client]bool
func NewClient(server *Server, conn net.Conn) *Client { func NewClient(server *Server, conn net.Conn) *Client {
read := StringReadChan(conn) read := StringReadChan(conn)
write := StringWriteChan(conn) write := StringWriteChan(conn)
replies := make(chan Reply, 1) replies := make(chan Reply)
client := &Client{ client := &Client{
conn: conn, conn: conn,

View File

@ -29,7 +29,7 @@ type Server struct {
} }
func NewServer(name string) *Server { func NewServer(name string) *Server {
commands := make(chan Command, 1) commands := make(chan Command)
server := &Server{ server := &Server{
ctime: time.Now(), ctime: time.Now(),
name: name, name: name,

View File

@ -29,7 +29,7 @@ type BaseService struct {
} }
func NewService(service EditableService, s *Server, name string) Service { func NewService(service EditableService, s *Server, name string) Service {
commands := make(chan ServiceCommand, 1) commands := make(chan ServiceCommand)
base := &BaseService{ base := &BaseService{
server: s, server: s,
name: name, name: name,

View File

@ -47,8 +47,8 @@ func (set UserSet) Nicks() []string {
} }
func NewUser(nick string, server *Server) *User { func NewUser(nick string, server *Server) *User {
commands := make(chan UserCommand, 1) commands := make(chan UserCommand)
replies := make(chan Reply, 1) replies := make(chan Reply)
user := &User{ user := &User{
nick: nick, nick: nick,
server: server, server: server,