mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
Make channels synchronous.
This commit is contained in:
parent
74aaf2f9d3
commit
0001131095
@ -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),
|
||||||
|
@ -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,
|
||||||
|
@ -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,
|
||||||
|
@ -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,
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user