Skip to content
This repository has been archived by the owner on Dec 2, 2023. It is now read-only.

Commit

Permalink
fix: extraInfo and avatar are not reflecting on UpdatePeer and AddPeer (
Browse files Browse the repository at this point in the history
#601)

* fix: peers avatar and extraInfo not updating on redis

Everywhere we have type declaration and usage for avatar and extraInfo for peer. But not set on redis while creating peers.

* fix: SA5011 lint error on room_signal file

Before pinfo null check routines returning error sid and uid are dereferenced.

Moved the dereference after error handling for null check.

* fix: extraInfo and avatar are not reflecting on UpdatePeer and AddPeer

On UpdatePeer event and AddPeer  methods there is missing implementation for updating or adding avatar and extrInfo of a peer.
  • Loading branch information
hariprasath2603 committed Jan 31, 2022
1 parent f360d91 commit 9c9f527
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/room/server/room_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ func (s *RoomService) AddPeer(ctx context.Context, in *room.AddPeerRequest) (*ro
role := in.Peer.Role.String()
protocol := in.Peer.Protocol.String()
direction := in.Peer.Direction.String()
avatar := in.Peer.Avatar
extraInfo := in.Peer.ExtraInfo

// check room exist
key := util.GetRedisRoomKey(sid)
Expand Down Expand Up @@ -273,7 +275,8 @@ func (s *RoomService) AddPeer(ctx context.Context, in *room.AddPeerRequest) (*ro
// store peer to redis
key = util.GetRedisPeerKey(sid, uid)
err := s.redis.HMSetTTL(roomRedisExpire, key, "sid", sid, "uid", uid, "dest", dest,
"name", name, "role", role, "protocol", protocol, "direction", direction)
"name", name, "role", role, "protocol", protocol, "direction", direction,
"avatar", avatar, "info", extraInfo)

if err != nil {
return &room.AddPeerReply{
Expand Down Expand Up @@ -308,6 +311,9 @@ func (s *RoomService) UpdatePeer(ctx context.Context, in *room.UpdatePeerRequest
role := in.Peer.Role.String()
protocol := in.Peer.Protocol.String()
direction := in.Peer.Direction.String()
avatar := in.Peer.Avatar
extraInfo := in.Peer.ExtraInfo


// check room exist
key := util.GetRedisRoomKey(sid)
Expand Down Expand Up @@ -359,7 +365,7 @@ func (s *RoomService) UpdatePeer(ctx context.Context, in *room.UpdatePeerRequest
key = util.GetRedisPeerKey(sid, uid)

err := s.redis.HMSetTTL(roomRedisExpire, key, "sid", sid, "uid", uid, "destination", destination,
"name", name, "role", role, "protocol", protocol, "direction", direction)
"name", name, "role", role, "protocol", protocol, "direction", direction,"avatar", avatar, "info", extraInfo )

if err != nil {
return &room.UpdatePeerReply{
Expand Down

0 comments on commit 9c9f527

Please sign in to comment.