mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Attempt to fix channel join / leave loop
I don't have a solid way to repro the issue, but this should hopefully help in resolving it. Either way, I think this change brings more correct behaviour (if a websocket message comes through that we have left the channel, I don't believe we should be sending a request to leave that channel again).
This commit is contained in:
@ -95,7 +95,7 @@ namespace osu.Game.Online.Chat
|
|||||||
{
|
{
|
||||||
connector.ChannelJoined += ch => Schedule(() => joinChannel(ch));
|
connector.ChannelJoined += ch => Schedule(() => joinChannel(ch));
|
||||||
|
|
||||||
connector.ChannelParted += ch => Schedule(() => LeaveChannel(getChannel(ch)));
|
connector.ChannelParted += ch => Schedule(() => leaveChannel(getChannel(ch), false));
|
||||||
|
|
||||||
connector.NewMessages += msgs => Schedule(() => addMessages(msgs));
|
connector.NewMessages += msgs => Schedule(() => addMessages(msgs));
|
||||||
|
|
||||||
@ -558,7 +558,9 @@ namespace osu.Game.Online.Chat
|
|||||||
/// Leave the specified channel. Can be called from any thread.
|
/// Leave the specified channel. Can be called from any thread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="channel">The channel to leave.</param>
|
/// <param name="channel">The channel to leave.</param>
|
||||||
public void LeaveChannel(Channel channel) => Schedule(() =>
|
public void LeaveChannel(Channel channel) => Schedule(() => leaveChannel(channel, true));
|
||||||
|
|
||||||
|
private void leaveChannel(Channel channel, bool sendLeaveRequest)
|
||||||
{
|
{
|
||||||
if (channel == null) return;
|
if (channel == null) return;
|
||||||
|
|
||||||
@ -584,7 +586,7 @@ namespace osu.Game.Online.Chat
|
|||||||
api.Queue(new LeaveChannelRequest(channel));
|
api.Queue(new LeaveChannelRequest(channel));
|
||||||
channel.Joined.Value = false;
|
channel.Joined.Value = false;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the most recently closed channel that has not already been reopened,
|
/// Opens the most recently closed channel that has not already been reopened,
|
||||||
|
Reference in New Issue
Block a user