1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Cedar: move buffer limit handling from ProtoHandleConnection() to protocol implementation

This allows greater control, required by SSTP: the limit only applies to data packets.
This commit is contained in:
Davide Beatrici 2020-07-12 03:09:12 +02:00
parent eb5150a002
commit 19dbdf46be
4 changed files with 3 additions and 16 deletions

View File

@ -431,8 +431,6 @@ bool ProtoHandleConnection(PROTO *proto, SOCK *sock, const char *protocol)
} }
} }
impl->BufferLimit(impl_data, FifoSize(send_fifo) > MAX_BUFFERING_PACKET_SIZE);
if (stop) if (stop)
{ {
// Error or disconnection occurs // Error or disconnection occurs

View File

@ -30,7 +30,6 @@ typedef struct PROTO_IMPL
bool (*IsPacketForMe)(const PROTO_MODE mode, const UCHAR *data, const UINT size); bool (*IsPacketForMe)(const PROTO_MODE mode, const UCHAR *data, const UINT size);
bool (*ProcessData)(void *param, TCP_RAW_DATA *in, FIFO *out); bool (*ProcessData)(void *param, TCP_RAW_DATA *in, FIFO *out);
bool (*ProcessDatagrams)(void *param, LIST *in, LIST *out); bool (*ProcessDatagrams)(void *param, LIST *in, LIST *out);
void (*BufferLimit)(void *param, const bool reached);
} PROTO_IMPL; } PROTO_IMPL;
typedef struct PROTO_SESSION typedef struct PROTO_SESSION

View File

@ -23,8 +23,7 @@ PROTO_IMPL *OvsGetProtoImpl()
OvsName, OvsName,
OvsIsPacketForMe, OvsIsPacketForMe,
OvsProcessData, OvsProcessData,
OvsProcessDatagrams, OvsProcessDatagrams
OvsBufferLimit,
}; };
return &impl; return &impl;
@ -185,6 +184,8 @@ bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out)
return false; return false;
} }
server->SupressSendPacket = FifoSize(out) > MAX_BUFFERING_PACKET_SIZE;
return ret; return ret;
} }
@ -229,16 +230,6 @@ bool OvsProcessDatagrams(void *param, LIST *in, LIST *out)
return true; return true;
} }
void OvsBufferLimit(void *param, const bool reached)
{
if (param == NULL)
{
return;
}
((OPENVPN_SERVER *)param)->SupressSendPacket = reached;
}
// Write the OpenVPN log // Write the OpenVPN log
void OvsLog(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, char *name, ...) void OvsLog(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, char *name, ...)
{ {

View File

@ -215,7 +215,6 @@ char *OvsName();
bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size); bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size);
bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out); bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out);
bool OvsProcessDatagrams(void *param, LIST *in, LIST *out); bool OvsProcessDatagrams(void *param, LIST *in, LIST *out);
void OvsBufferLimit(void *param, const bool reached);
bool OvsIsOk(void *param); bool OvsIsOk(void *param);
UINT OvsEstablishedSessions(void *param); UINT OvsEstablishedSessions(void *param);