[Live-devel] How do I terminate an active proxy session?

Ross Finlayson finlayson at live555.com
Wed Sep 14 22:13:43 PDT 2016


> I'm running the proxy server with user authentication added in. I want to limit the users to one-minute sessions at a time. What is the "proper" way to achieve this?

The way to do this is to delete (using “Medium::close()”) the “RTSPClientSession” object when the 1-minute time runs out.  (This will automatically shut down any streaming that’s currently underway for that session.)

Here’s what I’d do to implement this:
- Subclass “RTSPServer”, and, in your subclass, define the following (public) member functions:
	static void handleSessionExpiration(u_int32_t sessionId);
	void handleSessionExpiration1(u_int32_t sessionId);
- Also, redefine the “createNewClientSession()” virtual function, as follows:
	GenericMediaServer::ClientSession* MyRTSPServerSubclass::createNewClientSession(u_int32_t sessionId) {
		envir().taskScheduler().scheduleDelayedTask(60*1000000/*1 minute*/, (TaskFunc*)handleSessionExpiration, sessionId);
		return RTSPServer::createNewClientSession(sessionId);
	} 
- Implement "handleSessionExpiration()" and “handleSessionExpiration1()” as follows:
	void MyRTSPServerSubclass:: handleSessionExpiration(u_int32_t sessionId) {
		Some GlobalPointerToMyRTSPServer-> handleSessionExpiration1(sessionId);
	}
	void MyRTSPServerSubclass:: handleSessionExpiration1(u_int32_t sessionId) {
		Medium::close(lookupClientSession(sessionId));
	}

(Note that this has nothing to do with ‘authentication’; that’s a ‘red herring’.)


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list