⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sessionmgr.cpp

📁 pimserver是syncml_vc开发包的服务器实例
💻 CPP
字号:
// SessionMgr.cpp: implementation of the CSessionMgr class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "pimserver.h"
#include "SessionMgr.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSessionMgr::CSessionMgr()
{
	head=NULL;
}

CSessionMgr::~CSessionMgr()
{

}
CSyncSession* CSessionMgr::GetActiveSession()
{
   return active;

}
CSyncSession* CSessionMgr::GetSession(char * pSession)
{
	CSessionNode* pnode = head;
	//打印session
	while(pnode!=NULL&&pnode->self!=NULL)
	{
			
			XPTDEBUG(("SessionList %s\n",pnode->pSessName));
			pnode = pnode->next;
	}
	//搜索session
	pnode = head;

	while(pnode!=NULL&&pnode->self!=NULL)
	{
			if(strcmp(pnode->pSessName,pSession)==0)
			{
				active = pnode->self;
				return pnode->self;
			}
			else
				pnode = pnode->next;
	}
	//创建session
	CSessionNode *psess = (CSessionNode *)smlLibMalloc(sizeof(CSessionNode));
	psess->pSessName  = (char *)smlLibMalloc(smlLibStrlen(pSession));
	smlLibStrcpy(psess->pSessName,pSession);
	psess->self = new CSyncSession ();
	psess->next = head;
	head = psess;
	active = psess->self;
	return psess->self ;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -