solero / houdini

A Club Penguin private server written in Python 3
https://houdini.readthedocs.io/
MIT License
281 stars 54 forks source link

AS3 client cant receive more then 100 buddies #58

Open Bale001 opened 4 years ago

Bale001 commented 4 years ago

If a user has more than 100 buddies the client will break. Here is a screenshot of the bug happening (from a player in newcp) image image

To fix the bug, send the first 100 buddies in response to b#gb, the client will see you didnt send all their buddies and will send a u#rpfi packet. Send the rest of the users buddies in response to that (in a gb packet like before). Also, you still cannot send more then 100 buddies in response to the rpfi packet, so if the user has 230 buddies, send another 100 buddies in response to rpfi, and the client will keep sending an rpfi packet until all buddies are received.

ben-pearce commented 4 years ago

Hi, first of all, thank you for your detailed explanation and research into this bug, and apologies for my delayed response.

Unfortunately I am unable to replicate what you're experiencing.

I sent 110 buddies in the b#gb packet response but all 110 buddies show up.

Replaced line 88 with

await p.send_xt('gb', *buddies, *[f'{i}|P{i}|0' for i in range(110)])

In buddies.py.

And the result: Screenshot from 2020-09-27 23-05-51

Also, your explanation doesn't really make sense since, my buddies API has no handler for rpfi. It is mentioned in the original client but it leads nowhere, it has no client-side handlers. So I guess I don't really understand how that is solving the issue!

// airtower.as
var REFRESH_PLAYER_FRIEND_INFORMATION = "rpfi";
// shell.as
function sendRefreshPlayerFriendInfo()
{
   AIRTOWER.send(AIRTOWER.PLAY_EXT,AIRTOWER.PLAYER_HANDLER + "#" + AIRTOWER.REFRESH_PLAYER_FRIEND_INFORMATION,[],"str",getCurrentServerRoomId());
}

To confirm this, I sent half the buddies with b#gb and the rest with u#rpfi.

await p.send_xt('gb', *buddies, *[f'{i}|P{i}|0' for i in range(50)])
await p.send_xt('rpfi', *[f'{i}|P{i}|0' for i in range(50, 110)])

And I only got the first 50 buddies (sent in the gb (get buddy) handler):

Screenshot from 2020-09-27 23-11-44

To push this further, I tried with 1000 buddies, and they still all showed up.

Bale001 commented 4 years ago

First of all, I said to send the rest of the buddies in response to the rpfi packet, as in the client sends the rpfi packet, and I respond to it with a gb packet. I'm not really sure why yours works fine... i'll try recreating the bug later

AllinolCP commented 3 years ago

maybe this issue isn't caused by the dependency/packet itself, maybe its caused by the db throttled or something?

iContinux commented 3 years ago

maybe this issue isn't caused by the dependency/packet itself, maybe its caused by the db throttled or something?

Does it matter? Either way it is bad and must be fix the ben!

sky-is-winning commented 3 years ago

maybe this issue isn't caused by the dependency/packet itself, maybe its caused by the db throttled or something?

Surely if the db was throttled from getting buddies the same thing would happen with items, powercards, furniture and anything else that gets a load of entries from the db at the same time though?

AllinolCP commented 3 years ago

Yes but both of them doesn't use db_transaction

maybe this issue isn't caused by the dependency/packet itself, maybe its caused by the db throttled or something?

Surely if the db was throttled from getting buddies the same thing would happen with items, powercards, furniture and anything else that gets a load of entries from the db at the same time though?

Yes but items, powercards, furniture doesn't use db_transaction NVM they did

AllinolCP commented 3 years ago

I sent 230 buddies and the buddy list refuses to work at all, so i guess there's another lead on this story