Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Detaching bug + fix, Asss-1.1.7, Linux

 
Post new topic   Reply to topic Printable version
 View previous topic  Player name display Post :: Post [download] VS.NET source for ASSS  View next topic  
Author Message
Jackmn
Newbie


Joined: Apr 02 2004
Posts: 13
Offline

PostPosted: Fri Apr 02, 2004 3:47 pm    Post subject: Detaching bug + fix, Asss-1.1.7, Linux Reply to topic Reply with quote

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:
Code: Show/Hide
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
Quote:
if (pid2 == -1)

to
Quote:
if (pid2 == -1 && p->p_attached != -1)


As far as I have seen, this works. No guarantees though.
Back to top
View users profile Send private message Add User to Ignore List
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Fri Apr 02, 2004 4:20 pm    Post subject: Reply to topic Reply with quote

Actually the correct fix is to just reverse the comparison and change it to:
if (pid2 != -1)
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Jackmn
Newbie


Joined: Apr 02 2004
Posts: 13
Offline

PostPosted: Fri Apr 02, 2004 4:35 pm    Post subject: Reply to topic Reply with quote

That makes sense, I wasn't thinking.
Back to top
View users profile Send private message Add User to Ignore List
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Fri Apr 02, 2004 5:48 pm    Post subject: Reply to topic Reply with quote

table is farked up :/
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:42
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Fri Apr 02, 2004 7:02 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Tue Apr 06, 2004 10:33 am    Post subject: Reply to topic Reply with quote

lol its not a problem; the html tables were a tad messed up, im assuming cause of an unclosed table tag biggrin.gif but it anywho its all good icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 40 page(s) served in previous 5 minutes.

phpBB Created this page in 0.548005 seconds : 30 queries executed (77.8%): GZIP compression disabled