summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2018-03-28 09:32:08 +0200
committerDominique Martinet <asmadeus@codewreck.org>2018-03-28 09:35:35 +0200
commitdd627f3a53d93715ec7fb656a263e5945c4e5eba (patch)
treee7d47385482926dd3fbfc1d10b18199b3c96767e /src
parent57e8c9954663d616f85a5ccebbc4412d23728e17 (diff)
downloadweechat-dd627f3a53d93715ec7fb656a263e5945c4e5eba.zip
xfer: add xfer.network.send_ack option
This option disables sending acks during transfer, leaving only the final ack, as would naturally happen if sending ack ever returns EWOULDBLOCK.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/xfer/xfer-config.c7
-rw-r--r--src/plugins/xfer/xfer-config.h1
-rw-r--r--src/plugins/xfer/xfer-dcc.c7
-rw-r--r--src/plugins/xfer/xfer.c1
-rw-r--r--src/plugins/xfer/xfer.h1
5 files changed, 13 insertions, 4 deletions
diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c
index 5d037c94b..461f24c75 100644
--- a/src/plugins/xfer/xfer-config.c
+++ b/src/plugins/xfer/xfer-config.c
@@ -51,6 +51,7 @@ struct t_config_option *xfer_config_network_own_ip;
struct t_config_option *xfer_config_network_port_range;
struct t_config_option *xfer_config_network_speed_limit;
struct t_config_option *xfer_config_network_timeout;
+struct t_config_option *xfer_config_network_send_ack;
/* xfer config, file section */
@@ -296,6 +297,12 @@ xfer_config_init ()
N_("timeout for xfer request (in seconds)"),
NULL, 5, INT_MAX, "300", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ xfer_config_network_send_ack = weechat_config_new_option (
+ xfer_config_file, ptr_section,
+ "send_ack", "boolean",
+ N_("does not send acks when receiving files"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "file",
0, 0,
diff --git a/src/plugins/xfer/xfer-config.h b/src/plugins/xfer/xfer-config.h
index 6280e4667..6a2b16129 100644
--- a/src/plugins/xfer/xfer-config.h
+++ b/src/plugins/xfer/xfer-config.h
@@ -41,6 +41,7 @@ extern struct t_config_option *xfer_config_network_own_ip;
extern struct t_config_option *xfer_config_network_port_range;
extern struct t_config_option *xfer_config_network_speed_limit;
extern struct t_config_option *xfer_config_network_timeout;
+extern struct t_config_option *xfer_config_network_send_ack;
extern struct t_config_option *xfer_config_file_auto_accept_chats;
extern struct t_config_option *xfer_config_file_auto_accept_files;
diff --git a/src/plugins/xfer/xfer-dcc.c b/src/plugins/xfer/xfer-dcc.c
index 19d9ee99a..3b9bdf5df 100644
--- a/src/plugins/xfer/xfer-dcc.c
+++ b/src/plugins/xfer/xfer-dcc.c
@@ -309,7 +309,7 @@ xfer_dcc_resume_hash (struct t_xfer *xfer)
void
xfer_dcc_recv_file_child (struct t_xfer *xfer)
{
- int flags, num_read, ack_enabled, ready;
+ int flags, num_read, ready;
static char buffer[XFER_BLOCKSIZE_MAX];
time_t last_sent, new_time;
unsigned long long pos_last_ack;
@@ -362,7 +362,6 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
fcntl (xfer->sock, F_SETFL, flags | O_NONBLOCK);
last_sent = time (NULL);
- ack_enabled = 1;
pos_last_ack = 0;
while (1)
@@ -498,7 +497,7 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
}
/* send ACK to sender (if needed) */
- if (ack_enabled && (xfer->pos > pos_last_ack))
+ if (xfer->send_ack && (xfer->pos > pos_last_ack))
{
switch (xfer_dcc_recv_file_send_ack (xfer))
{
@@ -509,7 +508,7 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
return;
case 1:
/* send error, not fatal (buffer full?): disable ACKs */
- ack_enabled = 0;
+ xfer->send_ack = 0;
break;
case 2:
/* send OK: save position in file as last ACK sent */
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index 091bb06f1..9bf7f5442 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -501,6 +501,7 @@ xfer_alloc ()
new_xfer->filename_suffix = -1;
new_xfer->pos = 0;
new_xfer->ack = 0;
+ new_xfer->send_ack = weechat_config_boolean (xfer_config_network_send_ack);
new_xfer->start_resume = 0;
new_xfer->last_check_time = time_now;
new_xfer->last_check_pos = time_now;
diff --git a/src/plugins/xfer/xfer.h b/src/plugins/xfer/xfer.h
index 4720ee851..5cdb2df47 100644
--- a/src/plugins/xfer/xfer.h
+++ b/src/plugins/xfer/xfer.h
@@ -156,6 +156,7 @@ struct t_xfer
char *remote_nick_color; /* color name for remote nick */
/* (returned by IRC plugin) */
int fast_send; /* fast send file: does not wait ACK */
+ int send_ack; /* send ack on file receive */
int blocksize; /* block size for sending file */
time_t start_time; /* time when xfer started */
time_t start_transfer; /* time when xfer transfer started */