Merge remote-tracking branch 'origin/pr/1171'
This commit is contained in:
commit
060ba763f2
@ -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_port_range;
|
||||||
struct t_config_option *xfer_config_network_speed_limit;
|
struct t_config_option *xfer_config_network_speed_limit;
|
||||||
struct t_config_option *xfer_config_network_timeout;
|
struct t_config_option *xfer_config_network_timeout;
|
||||||
|
struct t_config_option *xfer_config_network_send_ack;
|
||||||
|
|
||||||
/* xfer config, file section */
|
/* xfer config, file section */
|
||||||
|
|
||||||
@ -296,6 +297,12 @@ xfer_config_init ()
|
|||||||
N_("timeout for xfer request (in seconds)"),
|
N_("timeout for xfer request (in seconds)"),
|
||||||
NULL, 5, INT_MAX, "300", NULL, 0,
|
NULL, 5, INT_MAX, "300", NULL, 0,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
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",
|
ptr_section = weechat_config_new_section (xfer_config_file, "file",
|
||||||
0, 0,
|
0, 0,
|
||||||
|
@ -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_port_range;
|
||||||
extern struct t_config_option *xfer_config_network_speed_limit;
|
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_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_chats;
|
||||||
extern struct t_config_option *xfer_config_file_auto_accept_files;
|
extern struct t_config_option *xfer_config_file_auto_accept_files;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@ -308,7 +309,7 @@ xfer_dcc_resume_hash (struct t_xfer *xfer)
|
|||||||
void
|
void
|
||||||
xfer_dcc_recv_file_child (struct t_xfer *xfer)
|
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];
|
static char buffer[XFER_BLOCKSIZE_MAX];
|
||||||
time_t last_sent, new_time;
|
time_t last_sent, new_time;
|
||||||
unsigned long long pos_last_ack;
|
unsigned long long pos_last_ack;
|
||||||
@ -345,6 +346,11 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set TCP_NODELAY to be more aggressive with acks */
|
||||||
|
/* ignore error as transfer should still work if this fails */
|
||||||
|
flags = 1;
|
||||||
|
setsockopt(xfer->sock, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags));
|
||||||
|
|
||||||
/* connection is OK, change DCC status (inform parent process) */
|
/* connection is OK, change DCC status (inform parent process) */
|
||||||
xfer_network_write_pipe (xfer, XFER_STATUS_ACTIVE,
|
xfer_network_write_pipe (xfer, XFER_STATUS_ACTIVE,
|
||||||
XFER_NO_ERROR);
|
XFER_NO_ERROR);
|
||||||
@ -356,7 +362,6 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
|
|||||||
fcntl (xfer->sock, F_SETFL, flags | O_NONBLOCK);
|
fcntl (xfer->sock, F_SETFL, flags | O_NONBLOCK);
|
||||||
|
|
||||||
last_sent = time (NULL);
|
last_sent = time (NULL);
|
||||||
ack_enabled = 1;
|
|
||||||
pos_last_ack = 0;
|
pos_last_ack = 0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
@ -492,7 +497,7 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send ACK to sender (if needed) */
|
/* 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))
|
switch (xfer_dcc_recv_file_send_ack (xfer))
|
||||||
{
|
{
|
||||||
@ -503,7 +508,7 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
|
|||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
/* send error, not fatal (buffer full?): disable ACKs */
|
/* send error, not fatal (buffer full?): disable ACKs */
|
||||||
ack_enabled = 0;
|
xfer->send_ack = 0;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
/* send OK: save position in file as last ACK sent */
|
/* send OK: save position in file as last ACK sent */
|
||||||
|
@ -501,6 +501,7 @@ xfer_alloc ()
|
|||||||
new_xfer->filename_suffix = -1;
|
new_xfer->filename_suffix = -1;
|
||||||
new_xfer->pos = 0;
|
new_xfer->pos = 0;
|
||||||
new_xfer->ack = 0;
|
new_xfer->ack = 0;
|
||||||
|
new_xfer->send_ack = weechat_config_boolean (xfer_config_network_send_ack);
|
||||||
new_xfer->start_resume = 0;
|
new_xfer->start_resume = 0;
|
||||||
new_xfer->last_check_time = time_now;
|
new_xfer->last_check_time = time_now;
|
||||||
new_xfer->last_check_pos = time_now;
|
new_xfer->last_check_pos = time_now;
|
||||||
|
@ -156,6 +156,7 @@ struct t_xfer
|
|||||||
char *remote_nick_color; /* color name for remote nick */
|
char *remote_nick_color; /* color name for remote nick */
|
||||||
/* (returned by IRC plugin) */
|
/* (returned by IRC plugin) */
|
||||||
int fast_send; /* fast send file: does not wait ACK */
|
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 */
|
int blocksize; /* block size for sending file */
|
||||||
time_t start_time; /* time when xfer started */
|
time_t start_time; /* time when xfer started */
|
||||||
time_t start_transfer; /* time when xfer transfer started */
|
time_t start_transfer; /* time when xfer transfer started */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user