From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.31.129.138 with SMTP id c132mr3247922vkd.21.1497563431030; Thu, 15 Jun 2017 14:50:31 -0700 (PDT) X-Received: by 10.157.82.166 with SMTP id f38mr234966oth.8.1497563430987; Thu, 15 Jun 2017 14:50:30 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!s24no551651qte.0!news-out.google.com!s132ni1632itb.0!nntp.google.com!f20no913276itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 15 Jun 2017 14:50:30 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=199.168.151.171; posting-account=MRPdDAoAAADUJmZVjnYaoafXFMadSeY1 NNTP-Posting-Host: 199.168.151.171 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1c2a9303-944c-44c5-a7d9-d92ab9910e35@googlegroups.com> Subject: Question: Controlled data and user disconnection interaction (Gnoga) From: Olivier Henley Injection-Date: Thu, 15 Jun 2017 21:50:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:46956 Date: 2017-06-15T14:50:30-07:00 List-Id: FIRST: I know this question should be asked on the Gnoga channel but everyb= ody there is here anyway + other qualified people so ... Using Gnoga for a multiplayer game, I have a question which I fail to answe= r myself because I do not know a) enough about Ada and b) enough about the = architecture of Gnoga/Simple Components stack. - note1: A match is two players connected through webRTC. - note2: To establish a webRTC connection between those two players I have = to relay some infos to one another, without delay. This sample code is a subset of what I have done to relay messages from one= player to the other. My question is about the eventual outcome of one play= er disconnecting while Relaying. Let suppose the 'other' player is killing = its browser. ---------------------------- procedure Relay_Signal (App_Data : in App_Data_Access; Value : String) is Other_App_Data : App_Data_Access :=3D Control.Find_Other(App_Data); begin if Other_App_Data /=3D null then My_Game.Controller.Relay_Signal(Other_App_Data, Value); end if; end Relay_Signal; protected Control is function Find_Other (App_Data : App_Data_Access) return App_Data_Acce= ss; private Matchs : Matchs_Vec.Vector; end Control; protected body Control is function Find_Other (App_Data : App_Data_Access) return App_Data_Acce= ss is begin if App_Data.Match_Index_Is_Valid then for Player of Matchs.Element(App_Data.Match_Index).Players loop if Player /=3D App_Data then return Player; end if; end loop; end if; return null; end Find_Other; end Control; ----------------------------- I suppose that in the worst case: Other_App_Data is found and returned from= Find_Other but that other player is disconnected (Other_App_Data becomes i= nvalid) just before My_Game.Controller.Relay_Signal(Other_App_Data, Value) = is called. What I think will happen is just an exception thrown when I am m= anipulating Other_App_Data inside Relay_Signal. 1) Am I right? If so is it OK? 2) Else, why and how should I handle such a case? Thx, Olivier