Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
p-shahi committed Apr 13, 2023
1 parent 2274cd1 commit 7f38ff3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions go-peer/chatroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ChatRoomBufSize = 128
// messages are pushed to the Messages channel.
type ChatRoom struct {
// Messages is a channel of messages received from other peers in the chat room
Messages chan *ChatMessage
Messages chan *ChatMessage
SysMessages chan *ChatMessage

ctx context.Context
Expand Down Expand Up @@ -52,14 +52,14 @@ func JoinChatRoom(ctx context.Context, ps *pubsub.PubSub, selfID peer.ID, nickna
}

cr := &ChatRoom{
ctx: ctx,
ps: ps,
topic: topic,
sub: sub,
self: selfID,
nick: nickname,
roomName: roomName,
Messages: make(chan *ChatMessage, ChatRoomBufSize),
ctx: ctx,
ps: ps,
topic: topic,
sub: sub,
self: selfID,
nick: nickname,
roomName: roomName,
Messages: make(chan *ChatMessage, ChatRoomBufSize),
SysMessages: make(chan *ChatMessage, ChatRoomBufSize),
}

Expand Down Expand Up @@ -93,7 +93,7 @@ func (cr *ChatRoom) readLoop() {
cm.Message = string(msg.Data)
cm.SenderID = msg.ID
cm.SenderNick = string(msg.ID[len(msg.ID)-8])

printErr("New message%s: %s\n", cm.Message)
// send valid messages onto the Messages channel
cr.Messages <- cm
}
Expand Down

0 comments on commit 7f38ff3

Please sign in to comment.