Game Development Community

Client.delete() crashes my demo

by Entr0py · in Torque Game Engine · 06/24/2004 (9:05 am) · 39 replies

I have looked all through the code and for the life of me I cannot figure out why client.delete() crashes me. I am calling it quite early, so is it possible that something needs to be initialized beforehand?
Page «Previous 1 2
#1
06/25/2004 (6:48 am)
Client is usually the ClientConnection object. You probably shouldn't be deleting it. It doesn't matter if your game is single player or not since Torque has no distinction between the two.
#2
06/25/2004 (8:18 am)
Well I need some way to disconnect somebody off my server.
#3
06/25/2004 (2:18 pm)
My bad.
Well ya. You would do something like:
%client.delete("You were kicked from the server");

That should work.
#4
06/28/2004 (3:27 am)
Yeah thats exactly what crashes me.
#5
07/12/2004 (2:57 am)
Are you trying to delete yourself as a test?

If so, that's why you crash.

If not, could you specify what server you are running and how you are testing it?
#6
07/12/2004 (7:41 am)
I don't think it should crash if you delete the player on a listen server...
#7
07/12/2004 (7:51 am)
I think it would if your the one running the server.. no server then game would either drop or crash..
if he is running the server and then removes the main server client then no server.. right?
or maybe I am wrong..
#8
07/12/2004 (1:32 pm)
Ben, the tree structure is different for a listen vs. a dedicated. Although I have not personally tested it, just looking at it tells me that if you delete the MAIN client on a listen server you crash, simple as that. There is no provision for separating the player from his server on a listen. In fact, a listen server is one of the worst ways to test most code simply because it reacts tottaly different than a dedicated.

How many times have you seen "Works perfectly untill we try it on the LAN or NET, then it doesn't work at all"?


It's because the modes of operation are so different. Tell you what, I'll go run the test on the latest head and see what happens.
#9
07/12/2004 (1:49 pm)
Confirmed. Delete the main client in a single player or multiplayer listen server and you crash the client. Ironicly enough, you do not crash the server and it continues to function just fine. The hosting client see's all activity stop and his lag icon comes up. But instead of dropping to the lobby after the timeout which would normally happen to the client, the hosting client stays locked into his game screen indefinately(or untill he exits the game which also kills the server).

So as best I can tell,

%client.delete("message");

is working just fine but as I stated before, you cannot test it correctly on a listen server. You can create a dedicated server and log into it from the same computer using a client and test it correctly because it separates the client from the server(same machine doesn't matter)
#10
07/12/2004 (4:11 pm)
I believe you are right Gonzo. I remember doing some debugging where I was accidently deleting myself and I crashed. I think you need to disconnect before you delete.
#11
07/12/2004 (4:16 pm)
If you disconnect the client of a listen server the server quits and everyone gets dropped with the message "The server dropped the connection".
#12
07/12/2004 (5:30 pm)
Maybe i'm misunderstanding. If you are running a server that is not dedicated then when you disconnect the server quits. That is what it should do. No? Maybe I don't understand what you are trying to do or what you want to happen on %client.delete
#13
07/12/2004 (5:36 pm)
Michael

The thread has evolved into more info than was needed.

Entropy originally had crashing problems when using the client.delete() function. I determined that he was most likely using a listen server which could not be used to gain an accurate test result. The conclusion was the function was workin fine, his test method was flawed.

The rest of this has just been basicaly an info discovery and clarification thread. And yes, you would want your listen server to quit when the host client disconnects. And it does. But using what we have learned, it is possible to alter your scripts slightly and be able to quit out of a listen server. One good use for such a trivial feature would be the ability to quickly start a server for a buddy and after he logs in give him admin or other powers and then exit out while leaving the server running. In fact, I think I'm going to mod in the option to do it both ways now that I think about it.
#14
07/12/2004 (7:32 pm)
Cool that clears things up.
#15
07/14/2004 (5:53 pm)
I am running a dedicated server. It crashes when I try to %client.delete any connection coming in.
#16
07/15/2004 (8:24 am)
Where is it crashing?
#17
07/19/2004 (4:03 pm)
Like I said, it is crashing when i call client.delete. Is there something I must do before I can use client.delete? Does the client have to be in the game already, or is simply being connected to the server enough?
#18
07/19/2004 (9:28 pm)
I meant, what line of C++ code...
#19
12/19/2004 (7:23 pm)
Well still no luck on this. I have put it off for a long time to see if anybody could tell me what's going on but nobody has. I absolutely *must* figure it out now.

I have to be able to disconnect a gameconnection in Gameconnection::Onconnect with script.

Like I said, %client.delete crashes the server. If I use a command to the client to disconnect, then the client crashes. I can close a gameconnection in GameConnection::onConnectRequest by sending an empty return, but it doesn't work in Gameconnection::Onconnect (which is what I need).

Please for the love of god somebody help.
#20
12/20/2004 (7:16 pm)
Here's the gdb info:

Program received signal SIGSEGV, Segmentation fault.
0x00609aba in NetInterface::handleConnectRequest(NetAddress const*, BitStream*)
(this=0x7c3c50, address=0x22f934, stream=0x22f850)
at sim/netInterface.cc:305
305 conn->setEstablished();
Page «Previous 1 2