diff options
author | ulim <a.sporto+bee@gmail.com> | 2007-12-04 01:53:04 +0100 |
---|---|---|
committer | ulim <a.sporto+bee@gmail.com> | 2007-12-04 01:53:04 +0100 |
commit | fa30fa598d2e77c998f9156d0f31ccf99b0c781f (patch) | |
tree | f238de491573827510c55e29cf80e2fda7ccc793 /dcc.h | |
parent | 2c2df7dd91930345a9b22a8bb61327d1dcc7e3d5 (diff) | |
parent | dce390357114e30a424106c99e49cef1e682e1af (diff) |
Jabber file transfer now also with sending! You can't use a proxy yet when
sending, that's my next task. You can use proxies when receiving though!
I also changed the buffering strategy. Previously receiving continued till some
buffer limit was reached, now only one message is received and receiving stops
till it is delivered. This keeps the buffering space per file transfer to a
minimum(currently 4k). Makes sense when used on a public server. For public
servers a throughput maximum would also be interesting...
Diffstat (limited to 'dcc.h')
-rw-r--r-- | dcc.h | 53 |
1 files changed, 7 insertions, 46 deletions
@@ -43,33 +43,9 @@ #ifndef _DCC_H #define _DCC_H -/* don't wait for acknowledgments */ -#define DCC_SEND_AHEAD - -/* This multiplier specifies how many bytes we - * can go ahead within one event loop cycle. Notice that all in all, - * we can easily be more ahead if the event loop shoots often enough. - * (or the receiver processes slow enough) - * - * Setting this value too high will cause send buffer overflows. - */ -#define DCC_SEND_AHEAD_MUL 10 - -/* - * queue thresholds for the out of data and overflow conditions - */ -#define DCC_QUEUE_THRESHOLD_LOW 2048 -#define DCC_QUEUE_THRESHOLD_HIGH 65536 - -/* only used in non-ahead mode */ +/* Send an ACK after receiving this amount of data */ #define DCC_PACKET_SIZE 1024 -/* stores buffers handed over by IM protocols */ -struct dcc_buffer { - char *b; - int len; -}; - typedef struct dcc_file_transfer { struct im_connection *ic; @@ -88,38 +64,23 @@ typedef struct dcc_file_transfer { gint watch_out; /* writable */ /* - * The total number of queued bytes. The following equality should always hold: - * - * queued_bytes = sum(queued_buffers.len) - buffer_pos - */ - unsigned int queued_bytes; - - /* - * A list of dcc_buffer structures. - * These are provided by the protocols directly so that no copying is neccessary. - */ - GSList *queued_buffers; - - /* - * current position within the first buffer. - * Is non-null if the whole buffer couldn't be sent at once. - */ - int buffer_pos; - - /* * The total amount of bytes that have been sent to the irc client. */ size_t bytes_sent; - /* imcb's handle */ + /* imc's handle */ file_transfer_t *ft; + /* if we're receiving, this is the sender's socket address */ + struct sockaddr_storage saddr; + } dcc_file_transfer_t; file_transfer_t *dccs_send_start( struct im_connection *ic, char *user_nick, char *file_name, size_t file_size ); void dcc_canceled( file_transfer_t *file, char *reason ); -gboolean dccs_send_write( file_transfer_t *file, gpointer data, unsigned int data_size ); +gboolean dccs_send_write( file_transfer_t *file, char *data, unsigned int data_size ); +file_transfer_t *dcc_request( struct im_connection *ic, char *line ); #endif |