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

Commit

Permalink
fix: peers avatar and extraInfo not updating on redis (#599)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
hariprasath2603 committed Jan 25, 2022
1 parent 118b8c4 commit f360d91
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/room/server/room_signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ func (s *RoomSignalService) Signal(stream room.RoomSignal_SignalServer) error {

func (s *RoomSignalService) Join(in *room.Request_Join, stream room.RoomSignal_SignalServer) (*room.Reply_Join, *Peer, error) {
pinfo := in.Join.Peer
sid := pinfo.Sid
uid := pinfo.Uid

if pinfo == nil || pinfo.Sid == "" && pinfo.Uid == "" {
reply := &room.Reply_Join{
Expand All @@ -113,6 +111,10 @@ func (s *RoomSignalService) Join(in *room.Request_Join, stream room.RoomSignal_S
}
return reply, nil, status.Errorf(codes.Internal, "sid/uid is empty")
}

sid := pinfo.Sid
uid := pinfo.Uid

key := util.GetRedisRoomKey(sid)
// create in redis if room not exist
if sid == "" {
Expand Down Expand Up @@ -181,7 +183,7 @@ func (s *RoomSignalService) Join(in *room.Request_Join, stream room.RoomSignal_S
// store peer to redis
key = util.GetRedisPeerKey(sid, uid)
err := s.rs.redis.HMSetTTL(roomRedisExpire, key, "sid", sid, "uid", uid, "dest", in.Join.Peer.Destination,
"name", in.Join.Peer.DisplayName, "role", in.Join.Peer.Role.String(), "protocol", in.Join.Peer.Protocol.String(), "direction", in.Join.Peer.Direction.String())
"name", in.Join.Peer.DisplayName, "role", in.Join.Peer.Role.String(), "protocol", in.Join.Peer.Protocol.String(), "direction", in.Join.Peer.Direction.String(), "avatar", in.Join.Peer.Avatar, "info", in.Join.Peer.ExtraInfo)
if err != nil {
reply := &room.Reply_Join{
Join: &room.JoinReply{
Expand Down

0 comments on commit f360d91

Please sign in to comment.