transport: added function to get bytes written
added function to get written bytes on transport. This is needed to get a more accurate bandwidth management.
This commit is contained in:
parent
951a40b639
commit
9c0d275548
@ -275,6 +275,8 @@ FREERDP_API const char* freerdp_get_last_error_name(UINT32 error);
|
|||||||
FREERDP_API const char* freerdp_get_last_error_string(UINT32 error);
|
FREERDP_API const char* freerdp_get_last_error_string(UINT32 error);
|
||||||
FREERDP_API void freerdp_set_last_error(rdpContext* context, UINT32 lastError);
|
FREERDP_API void freerdp_set_last_error(rdpContext* context, UINT32 lastError);
|
||||||
|
|
||||||
|
FREERDP_API ULONG freerdp_get_transport_sent(rdpContext* context, BOOL resetCount);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -697,3 +697,10 @@ void freerdp_free(freerdp* instance)
|
|||||||
free(instance);
|
free(instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FREERDP_API ULONG freerdp_get_transport_sent(rdpContext* context, BOOL resetCount) {
|
||||||
|
ULONG written = context->rdp->transport->written;
|
||||||
|
if (resetCount)
|
||||||
|
context->rdp->transport->written = 0;
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
@ -576,10 +576,12 @@ int transport_write(rdpTransport* transport, wStream* s)
|
|||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
int status = -1;
|
int status = -1;
|
||||||
|
int writtenlength = 0;
|
||||||
|
|
||||||
EnterCriticalSection(&(transport->WriteLock));
|
EnterCriticalSection(&(transport->WriteLock));
|
||||||
|
|
||||||
length = Stream_GetPosition(s);
|
length = Stream_GetPosition(s);
|
||||||
|
writtenlength = length;
|
||||||
Stream_SetPosition(s, 0);
|
Stream_SetPosition(s, 0);
|
||||||
|
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
@ -637,8 +639,10 @@ int transport_write(rdpTransport* transport, wStream* s)
|
|||||||
length -= status;
|
length -= status;
|
||||||
Stream_Seek(s, status);
|
Stream_Seek(s, status);
|
||||||
}
|
}
|
||||||
|
transport->written += writtenlength;
|
||||||
|
|
||||||
out_cleanup:
|
out_cleanup:
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
/* A write error indicates that the peer has dropped the connection */
|
/* A write error indicates that the peer has dropped the connection */
|
||||||
|
@ -76,6 +76,7 @@ struct rdp_transport
|
|||||||
BOOL GatewayEnabled;
|
BOOL GatewayEnabled;
|
||||||
CRITICAL_SECTION ReadLock;
|
CRITICAL_SECTION ReadLock;
|
||||||
CRITICAL_SECTION WriteLock;
|
CRITICAL_SECTION WriteLock;
|
||||||
|
ULONG written;
|
||||||
};
|
};
|
||||||
|
|
||||||
wStream* transport_send_stream_init(rdpTransport* transport, int size);
|
wStream* transport_send_stream_init(rdpTransport* transport, int size);
|
||||||
|
Loading…
Reference in New Issue
Block a user