ion icon indicating copy to clipboard operation
ion copied to clipboard

fix sending repetitive and inactive peers

Open aminyazdanpanah opened this issue 2 years ago • 3 comments

Description

This pull request fixes sending repetitive and inactive peers to the new peer. https://github.com/pion/ion/blob/118b8c419822088b948d98466a9e173b7fe50317/apps/room/server/room_signal.go#L207-L242

These above lines of code send every peer that was saved in the Redis to the new peer. For example, if a user attempted to join the room twice, it will record two peers in the Redis (assuming UIDs are different due to security issues). Besides, if the user leaves the room, it won't delete the record in Redis.

Instead, I removed these lines and created a new function to do this job. In this function, it will send all peers that are saved in addpeer method.

This function sends all active peers to the new peer

https://github.com/aminyazdanpanah/ion/blob/f0677770b63f4fbd6decff92b4db3b62c79740ba/apps/room/server/room_signal.go#L277-299

Hope this clarifies the issue.

aminyazdanpanah avatar Dec 03 '21 14:12 aminyazdanpanah

@aminyazdanpanah Thanks for this PR!! ION is a distributed system(strong consistency), we store track infos in redis so that other singal-Node can use the same infos. I think we should fix redis issue

adwpc avatar Jan 24 '22 06:01 adwpc

Hi @adwpc

Thanks for reviewing!

Actually, this PR does not have any impact on storing track Infos in Redis. the lines of code that I removed just fetch other peers from Redis and send them to the new peer.

Btw, thank you for spending time on this PR

aminyazdanpanah avatar Feb 18 '22 16:02 aminyazdanpanah

@aminyazdanpanah Thanks! we should delete the record in redis if the user leaves the room

adwpc avatar Mar 02 '22 09:03 adwpc