 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Jackmn Newbie
Joined: Apr 02 2004 Posts: 13 Offline
|
Posted: Fri Apr 02, 2004 3:47 pm Post subject: Detaching bug + fix, Asss-1.1.7, Linux |
 |
|
|
|
Sorry, couldn't decide whether to post this here or in the custom code section.
Problem:
With Continuum 0.38 ( other versions untested ), detaching doesn't appear to work. While the detaching client sees itself as being detached, the other players view the said client as remaining attached.
This creates some rather spectacular problems when the client starts shooting, as others see his/her bullets appearing out of nowhere.
Diagnosis:
game.c
=======
local void PAttach(Player *p, byte *pkt2, int len)
{
int pid2 = ((struct SimplePacket*)pkt2)->d1;
Arena *arena = p->arena;
if (len != 3)
{
lm->LogP(L_MALICIOUS, "game", p, "bad attach req packet len=%i", len);
return;
}
if (p->status != S_PLAYING || !arena)
return;
if (pid2 == -1)
{
Player *to = pd->PidToPlayer(pid2);
if (!to ||
to->status != S_PLAYING ||
to == p ||
p->arena != to->arena ||
p->p_freq != to->p_freq)
{
lm->LogP(L_MALICIOUS, "game", p, "tried to attach to bad pid %d", pid2);
return;
}
<snip>
} |
When a client detaches, it sends a 'attach' message with a PID of -1. Since that isn't a valid player, the warning gets logged and the function returns without storing ( and later broadcasting ) the detach. Since the game is client based, the client believes it has detached, while nobody else recieves notification of this.
Solution:
Thankfully very simple.
In the above function, change the line
to
Quote: | if (pid2 == -1 && p->p_attached != -1) |
As far as I have seen, this works. No guarantees though. |
|
Back to top |
|
 |
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: Fri Apr 02, 2004 4:20 pm Post subject: |
 |
|
|
|
Actually the correct fix is to just reverse the comparison and change it to:
if (pid2 != -1) |
|
Back to top |
|
 |
Jackmn Newbie
Joined: Apr 02 2004 Posts: 13 Offline
|
Posted: Fri Apr 02, 2004 4:35 pm Post subject: |
 |
|
|
|
That makes sense, I wasn't thinking. |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Fri Apr 02, 2004 5:48 pm Post subject: |
 |
|
|
|
table is farked up :/ _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:42 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Fri Apr 02, 2004 7:02 pm Post subject: |
 |
|
|
|
CypherJF wrote: | table is farked up :/ |
I'm working on school first, the forums second. Almost got the archives ready, and when I do, I'll globally update the main forums too. |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Tue Apr 06, 2004 10:33 am Post subject: |
 |
|
|
|
lol its not a problem; the html tables were a tad messed up, im assuming cause of an unclosed table tag but it anywho its all good  |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 40 page(s) served in previous 5 minutes.
|