fix: fixing memory leak from unbuffered channel
This commit is contained in:
@@ -23,9 +23,9 @@ type Client struct {
|
||||
func NewClient(conn *websocket.Conn, subscribedPath string) *Client {
|
||||
return &Client{
|
||||
Conn: conn,
|
||||
Send: make(chan []byte, 64),
|
||||
Send: make(chan []byte, 2),
|
||||
SubscribedPath: subscribedPath,
|
||||
done: make(chan struct{}),
|
||||
done: make(chan struct{}, 1),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ type Hub struct {
|
||||
|
||||
func NewHub() *Hub {
|
||||
return &Hub{
|
||||
Broadcast: make(chan []byte),
|
||||
Register: make(chan *Client),
|
||||
Unregister: make(chan *Client),
|
||||
Clients: make(map[*Client]bool),
|
||||
Broadcast: make(chan []byte, 1),
|
||||
Register: make(chan *Client, 1),
|
||||
Unregister: make(chan *Client, 1),
|
||||
Clients: make(map[*Client]bool, 1),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user