It’s actually not doing either of those things!
What this function does is check whether the server is advertising it’s presence via Bonjour. Since Bonjour uses separate code and a separate port from processing server requests, it’s possible that Bonjour could indicate that the server is running even though the server is not responding to queries.
It sounds like you want the checkserverconnection( function. Though if the server is actually “hung”, this function is not going to return any result until the timeout occurs.
I can’t remember a Panorama server (whether 6 or X) getting into a hung state. Generally it’s either running or stopped completely. Of course you could write a web procedure with an infinite loop, but that seems rather unusual. Is that what you are concerned about? Or are you somehow getting an unresponsive server some other way?
By the way, the localpanoramaxserverisrunning() function was created for the use of the Server Administration panel. When you change a server setting, Panorama uses this function to check to see if the local server is running. If it is, it then sends a message to the running server telling it to immediately change the setting. If the server is not running, then it simply changes the preference value via setpreferencevalues, and the next time the server starts it will pick up the new value.