mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-28 22:12:07 -08:00
generalize server name/listen.
This commit is contained in:
parent
96cb8240e6
commit
4cee1ef909
5 changed files with 16 additions and 6 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
)
|
||||
|
||||
type Server struct {
|
||||
name string
|
||||
ch chan *ClientMessage
|
||||
nicks map[string]*Client
|
||||
}
|
||||
|
|
@ -15,8 +16,9 @@ type ClientMessage struct {
|
|||
message Message
|
||||
}
|
||||
|
||||
func NewServer() *Server {
|
||||
func NewServer(name string) *Server {
|
||||
server := new(Server)
|
||||
server.name = name
|
||||
server.ch = make(chan *ClientMessage)
|
||||
server.nicks = make(map[string]*Client)
|
||||
go server.Receive()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue