mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 21:24:28 -08:00
Replace cfile.c with connection.c
- cfile.h needed too many function calls and was too complex
- connection.h does
- only download in binary mode (json can handle that)
- have no excess of getters and setters
- allow to execute the whole request in a single function call
- allow to be re-used for multiple requests
- as a result, the code has 600 lines of code less
- originally, connection.h was developed to use a global curl
handle for all requests such that the same connection could be
re-used. Unfortunately the MediaFire servers will close the
connection after each request from their end:
Bryan: "Unfortunately, we won't ever do keep-alive. Closing the
connection is a small part of a larger set of heuristics we have in
place to prevent DOS/DDOS attacks."
This causes massive performance impacts and those grow even larger when
using SSL because the handshake has to be executed for every single
request again.
This commit is contained in:
17
private.h
17
private.h
@@ -22,11 +22,14 @@
|
||||
#define _MFSHELL_PRIVATE_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
typedef struct _mfshell_s _mfshell_t;
|
||||
typedef struct _folder_s _folder_t;
|
||||
typedef struct _file_s _file_t;
|
||||
typedef struct _cmd_s _cmd_t;
|
||||
typedef struct _conn_s _conn_t;
|
||||
|
||||
struct _cmd_s
|
||||
{
|
||||
@@ -59,6 +62,20 @@ struct _file_s
|
||||
char *onetime_link;
|
||||
};
|
||||
|
||||
struct _conn_s
|
||||
{
|
||||
CURL *curl_handle;
|
||||
char *write_buf;
|
||||
size_t write_buf_len;
|
||||
double ul_len;
|
||||
double ul_now;
|
||||
double dl_len;
|
||||
double dl_now;
|
||||
bool show_progress;
|
||||
char error_buf[CURL_ERROR_SIZE];
|
||||
FILE *stream;
|
||||
};
|
||||
|
||||
struct _mfshell_s
|
||||
{
|
||||
int app_id;
|
||||
|
||||
Reference in New Issue
Block a user