views:

40

answers:

0

Hi,

I'm Fabio and i'm here to find help with an issue about GameKit.

I'm writing a program that allow users to play online games. The program use "manual" GkSession (without GkPeerPicker 'cause I need 4 connection).

NSString *name=[[NSString alloc] initWithUTF8String:pData->m_sPlayerName];
if(pNetMgr->GetServerMode())
    self.currentSession = [[GKSession alloc] initWithSessionID:@"OgreNetRace" displayName:name sessionMode:GKSessionModeServer];
else 
    self.currentSession = [[GKSession alloc] initWithSessionID:@"OgreNetRace" displayName:name sessionMode:GKSessionModeClient];

self.currentSession.delegate = self;
[self.currentSession setAvailable:YES];
self.currentSession.disconnectTimeout = 0;

[self.currentSession setDataReceiveHandler:self withContext:nil];
m_sPeerDevice=self.currentSession.peerID;

Like you can see i'm using Server/Client mode. When I don't need anymore this Session I call this:

[self.currentSession disconnectFromAllPeers];
[self.currentSession setAvailable:NO];
[self.currentSession setDelegate:nil];
[self.currentSession setDataReceiveHandler:nil withContext:nil];
[self.currentSession release];
currentSession = nil;

The problem is that many times when I release the session in server mode and I recreate in Client mode I see in the avaible list my old session. And doing monkey testes with menus this appear so many time that I can get even several of my old sessions. How can I delete it for sure or how can I catch if session has succesfully released his instance?

Many Regards in advance.