mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Added up/down stats
This commit is contained in:
parent
770eaca81e
commit
cf197e0aa6
2 changed files with 10 additions and 0 deletions
|
|
@ -738,6 +738,9 @@ typedef struct {
|
|||
typedef struct {
|
||||
lua_State* vm;
|
||||
time_t last_conn_check;
|
||||
struct {
|
||||
u_int32_t download, upload;
|
||||
} bytes;
|
||||
} ProgressState;
|
||||
|
||||
struct pcap_disk_timeval {
|
||||
|
|
|
|||
|
|
@ -1929,6 +1929,8 @@ bool Utils::progressCanContinue(ProgressState *progressState) {
|
|||
static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) {
|
||||
ProgressState *progressState = (ProgressState*) clientp;
|
||||
|
||||
progressState->bytes.download = (u_int32_t)dlnow, progressState->bytes.upload = (u_int32_t)ulnow;
|
||||
|
||||
return Utils::progressCanContinue(progressState) ? 0 /* continue */ : 1 /* stop transfer */;
|
||||
}
|
||||
|
||||
|
|
@ -2127,6 +2129,11 @@ bool Utils::httpGetPost(lua_State* vm, char *url,
|
|||
if(curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &redirection) == CURLE_OK)
|
||||
lua_push_str_table_entry(vm, "EFFECTIVE_URL", redirection);
|
||||
|
||||
if(!form_data) {
|
||||
lua_push_uint64_table_entry(vm, "BYTES_DOWNLOAD", progressState.bytes.download);
|
||||
lua_push_uint64_table_entry(vm, "BYTES_UPLOAD", progressState.bytes.upload);
|
||||
}
|
||||
|
||||
if(!ret)
|
||||
lua_push_bool_table_entry(vm, "IS_PARTIAL", true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue