1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-10 01:34:58 +03:00

v4.10-9505-beta

This commit is contained in:
dnobori
2014-10-04 00:09:23 +09:00
parent 16b713b98d
commit 10d4b2c43d
349 changed files with 2640 additions and 898 deletions

View File

@ -235,6 +235,19 @@ bool IsSupportedWinVer(RPC_WINVER *v)
}
}
#if 0
// Enable in future when supported
if (v->VerMajor == 6 && v->VerMinor == 4)
{
// Windows 10, Server 10
if (v->ServicePack <= 0)
{
// SP0 only
return true;
}
}
#endif
return false;
}
@ -1149,6 +1162,118 @@ void StopAllListener(CEDAR *c)
Free(array);
}
// Budget management functions
void CedarAddQueueBudget(CEDAR *c, int diff)
{
// Validate arguments
if (c == NULL || diff == 0)
{
return;
}
Lock(c->QueueBudgetLock);
{
int v = (int)c->QueueBudget;
v += diff;
c->QueueBudget = (UINT)v;
}
Unlock(c->QueueBudgetLock);
}
void CedarAddFifoBudget(CEDAR *c, int diff)
{
// Validate arguments
if (c == NULL || diff == 0)
{
return;
}
Lock(c->FifoBudgetLock);
{
int v = (int)c->FifoBudget;
v += diff;
c->FifoBudget = (UINT)v;
}
Unlock(c->FifoBudgetLock);
}
UINT CedarGetQueueBudgetConsuming(CEDAR *c)
{
// Validate arguments
if (c == NULL)
{
return 0;
}
return c->QueueBudget;
}
UINT CedarGetFifoBudgetConsuming(CEDAR *c)
{
// Validate arguments
if (c == NULL)
{
return 0;
}
return c->FifoBudget;
}
UINT CedarGetQueueBudgetBalance(CEDAR *c)
{
UINT current = CedarGetQueueBudgetConsuming(c);
UINT budget = QUEUE_BUDGET;
if (current <= budget)
{
return budget - current;
}
else
{
return 0;
}
}
UINT CedarGetFifoBudgetBalance(CEDAR *c)
{
UINT current = CedarGetFifoBudgetConsuming(c);
UINT budget = FIFO_BUDGET;
if (current <= budget)
{
return budget - current;
}
else
{
return 0;
}
}
// Add the current TCP queue size
void CedarAddCurrentTcpQueueSize(CEDAR *c, int diff)
{
// Validate arguments
if (c == NULL || diff == 0)
{
return;
}
Lock(c->CurrentTcpQueueSizeLock);
{
int v = (int)c->CurrentTcpQueueSize;
v += diff;
c->CurrentTcpQueueSize = (UINT)v;
}
Unlock(c->CurrentTcpQueueSizeLock);
}
// Get the current TCP queue size
UINT CedarGetCurrentTcpQueueSize(CEDAR *c)
{
// Validate arguments
if (c == NULL)
{
return 0;
}
return c->CurrentTcpQueueSize;
}
// Stop Cedar
void StopCedar(CEDAR *c)
{
@ -1269,6 +1394,12 @@ void CleanupCedar(CEDAR *c)
DeleteLock(c->CurrentRegionLock);
DeleteLock(c->CurrentTcpQueueSizeLock);
DeleteLock(c->QueueBudgetLock);
DeleteLock(c->FifoBudgetLock);
DeleteCounter(c->CurrentActiveLinks);
Free(c);
}
@ -1524,6 +1655,8 @@ CEDAR *NewCedar(X *server_x, K *server_k)
c = ZeroMalloc(sizeof(CEDAR));
c->CurrentActiveLinks = NewCounter();
c->AcceptingSockets = NewCounter();
c->CedarSuperLock = NewLock();
@ -1539,6 +1672,10 @@ CEDAR *NewCedar(X *server_x, K *server_k)
c->AssignedBridgeLicense = NewCounter();
c->AssignedClientLicense = NewCounter();
c->CurrentTcpQueueSizeLock = NewLock();
c->QueueBudgetLock = NewLock();
c->FifoBudgetLock = NewLock();
Rand(c->UniqueId, sizeof(c->UniqueId));
c->CreatedTick = Tick64();