How Do You Detect The End Of A Session?

I’ve got sessions working with the Null interface. Joining a lan server in a packaged game and stuff. However, I’m curious, how do you detect that a session is over?

Let’s say, for instance, you start a dedicated or listen lan server. You advertise over lan with the Null interface. A client listens for this, gets the session info and joins it with the resolved connection string.

I can see several possibilities for this to end:

  • Client disconnects mid-game. Session ends.

  • Client ends map and disconnects before next map and returns to the menu. Session ends.

  • Client continues to play on the next map. Session continues.

I was thinking “returning to the menu map” might be the trigger, but the player could very well, in the first 2 examples above, connect to a different server instead of returning to the menu.

So, is there any absolute way to tell if the session is over? Does the engine automatically leave the session if the server is disconnected from?

Thanks.