diff --git a/src/Cedar/Session.c b/src/Cedar/Session.c index 5bd5fa19..6f7cdb4a 100644 --- a/src/Cedar/Session.c +++ b/src/Cedar/Session.c @@ -1261,21 +1261,10 @@ void StopSessionEx(SESSION *s, bool no_wait) // Event Set(s->HaltEvent); - if (s->ServerMode == false) + // Server and client mode + if (s->Connection) { - // Client mode - if (s->Connection) - { - StopConnection(s->Connection, no_wait); - } - } - else - { - // Server mode - if (s->Connection) - { - StopConnection(s->Connection, no_wait); - } + StopConnection(s->Connection, no_wait); } // Wait until the stop @@ -1863,23 +1852,6 @@ SKIP: } } -// Name comparison of sessions -int CompareSession(void *p1, void *p2) -{ - SESSION *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(SESSION **)p1; - s2 = *(SESSION **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - return StrCmpi(s1->Name, s2->Name); -} - // Create an RPC session SESSION *NewRpcSession(CEDAR *cedar, CLIENT_OPTION *option) { @@ -2109,52 +2081,6 @@ SESSION *NewClientSession(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth return NewClientSessionEx(cedar, option, auth, pa, NULL, NicDownOnDisconnect); } -// Get the session from the 32bit session key -SESSION *GetSessionFromKey32(CEDAR *cedar, UINT key32) -{ - HUB *h; - UINT i, j; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - LockList(cedar->HubList); - { - for (i = 0;i < LIST_NUM(cedar->HubList);i++) - { - h = LIST_DATA(cedar->HubList, i); - LockList(h->SessionList); - { - for (j = 0;j < LIST_NUM(h->SessionList);j++) - { - SESSION *s = LIST_DATA(h->SessionList, j); - Lock(s->lock); - { - if (s->SessionKey32 == key32) - { - // Session found - AddRef(s->ref); - - // Unlock - Unlock(s->lock); - UnlockList(h->SessionList); - UnlockList(cedar->HubList); - return s; - } - } - Unlock(s->lock); - } - } - UnlockList(h->SessionList); - } - } - UnlockList(cedar->HubList); - - return NULL; -} - // Get the session from the session key SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key) { @@ -2391,20 +2317,6 @@ bool IsIpcMacAddress(UCHAR *mac) return false; } -// Display the session key for debugging -void DebugPrintSessionKey(UCHAR *session_key) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (session_key == NULL) - { - return; - } - - Bit160ToStr(tmp, session_key); - Debug("SessionKey: %s\n", tmp); -} - // Display the status on the client void PrintStatus(SESSION *s, wchar_t *str) { diff --git a/src/Cedar/Session.h b/src/Cedar/Session.h index c56338b9..c7f8ef7a 100644 --- a/src/Cedar/Session.h +++ b/src/Cedar/Session.h @@ -413,15 +413,12 @@ void StopSession(SESSION *s); void StopSessionEx(SESSION *s, bool no_wait); bool SessionConnect(SESSION *s); bool ClientConnect(CONNECTION *c); -int CompareSession(void *p1, void *p2); PACKET_ADAPTER *NewPacketAdapter(PA_INIT *init, PA_GETCANCEL *getcancel, PA_GETNEXTPACKET *getnext, PA_PUTPACKET *put, PA_FREE *free); void FreePacketAdapter(PACKET_ADAPTER *pa); void SessionMain(SESSION *s); void NewSessionKey(CEDAR *cedar, UCHAR *session_key, UINT *session_key_32); SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key); -SESSION *GetSessionFromKey32(CEDAR *cedar, UINT key32); -void DebugPrintSessionKey(UCHAR *session_key); bool IsIpcMacAddress(UCHAR *mac); void ClientAdditionalConnectChance(SESSION *s); void SessionAdditionalConnect(SESSION *s);