ClearBox Server™ v1.2 Developer's Guide

ISynchronizer::Synchronize

Called by server periodically to synchronize extension's database of current sessions records with actual sessions list on the NAS.

HRESULT Synchronize(
	[in] long nasIPAddr,
	[in] unsigned long syncSize,
	[in] USERADDRESS * usersList,
	[out] VARIANT_BOOL * continueMonitoring);

Parameters

nasIPAddr
[in] IP address of NAS whose records should be synchronized.
syncSize
[in] Number of records in array pointed by usersList.
usersList
[in] Array of records containing information about all users connected to the NAS indicated by nasIPAddr.
continueMonitoring
[out] If extension doesn't need to receive synchronization calls any more, it must set this parameter to VARIANT_FALSE, VARIANT_TRUE to continue synchronization.

Return Values

If server extension returns error code, server will repeat its synchronization attempt after a definite time span elapses (configured by Server Manager in Synchronization fail retry interval property).

Thread Safety

This method is called in context of SYNC thread. (See Server Threads Model for details.) You should synchronize data which is shared with other threads.

Memory Management

Memory pointed by usersList is allocated and freed by server.

Example Code

This code checks if John's session is actually active using information (usersList) provided by synchronization module. If accounting records say wrong, extension records internally that Jonh's session has ended.

STDMETHODIMP CTest::Synchronize(long nasIPAddr, unsigned long syncSize, 
	USERADDRESS * usersList, VARIANT_BOOL * continueMonitoring )
{
	// Note that we don't check NAS address for simplicity
	*continueMonitoring=VARIANT_TRUE;
	bool johnFound=false;
	for (int i=0;i<syncSize;i++)
		if (wcscmp(usersList[i].userName,L"John")==0)
		{
			johnFound=true;
			break;
		}
	// If accounting record say that John's session is active
	if (IsUsersSessionStarted(L"John") && johnFound)
		ReleaseSessionInfo(L"John");
	// IsUsersSessionStarted and ReleaseSessionInfo - some functions 
	// defined by extension
}

See Also

ISynchronizer, Synchronization concepts, Synchronization process


© 2001-2003 XPerience Technologies. www.xperiencetech.com

Created by chm2web html help conversion utility.