mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Removed /SET dcc_block_size and /SET dcc_fast_send - fast send is now
always used and dcc_block_size is useless with it. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1250 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c1c7674ae2
commit
19dff227d8
@ -92,8 +92,7 @@ static void sig_dcc_destroyed(CHAT_DCC_REC *dcc)
|
||||
dcc_remove_chat_refs(dcc);
|
||||
|
||||
if (dcc->sendbuf != NULL) net_sendbuffer_destroy(dcc->sendbuf, FALSE);
|
||||
line_split_free((LINEBUF_REC *) dcc->databuf);
|
||||
dcc->databuf = NULL;
|
||||
line_split_free(dcc->readbuf);
|
||||
g_free(dcc->id);
|
||||
}
|
||||
|
||||
@ -293,7 +292,7 @@ static void dcc_chat_input(CHAT_DCC_REC *dcc)
|
||||
do {
|
||||
recvlen = net_receive(dcc->handle, tmpbuf, sizeof(tmpbuf));
|
||||
|
||||
ret = line_split(tmpbuf, recvlen, &str, (LINEBUF_REC **) &dcc->databuf);
|
||||
ret = line_split(tmpbuf, recvlen, &str, &dcc->readbuf);
|
||||
if (ret == -1) {
|
||||
/* connection lost */
|
||||
dcc->connection_lost = TRUE;
|
||||
|
@ -13,6 +13,7 @@ struct CHAT_DCC_REC {
|
||||
#include "dcc-rec.h"
|
||||
|
||||
char *id; /* unique identifier - usually same as nick. */
|
||||
LINEBUF_REC *readbuf;
|
||||
NET_SENDBUF_REC *sendbuf;
|
||||
|
||||
unsigned int mirc_ctcp:1; /* Send CTCPs without the CTCP_MESSAGE prefix */
|
||||
|
@ -139,10 +139,11 @@ static void sig_dccget_send(GET_DCC_REC *dcc)
|
||||
/* input function: DCC GET received data */
|
||||
static void sig_dccget_receive(GET_DCC_REC *dcc)
|
||||
{
|
||||
char buffer[512];
|
||||
int ret;
|
||||
|
||||
for (;;) {
|
||||
ret = net_receive(dcc->handle, dcc->databuf, dcc->databufsize);
|
||||
ret = net_receive(dcc->handle, buffer, sizeof(buffer));
|
||||
if (ret == 0) break;
|
||||
|
||||
if (ret < 0) {
|
||||
@ -152,7 +153,7 @@ static void sig_dccget_receive(GET_DCC_REC *dcc)
|
||||
return;
|
||||
}
|
||||
|
||||
write(dcc->fhandle, dcc->databuf, ret);
|
||||
write(dcc->fhandle, buffer, ret);
|
||||
dcc->transfd += ret;
|
||||
}
|
||||
|
||||
@ -203,10 +204,6 @@ static void sig_dccget_connected(GET_DCC_REC *dcc)
|
||||
}
|
||||
}
|
||||
|
||||
dcc->databufsize = settings_get_int("dcc_block_size");
|
||||
if (dcc->databufsize <= 0) dcc->databufsize = 2048;
|
||||
dcc->databuf = g_malloc(dcc->databufsize);
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->tagread = g_input_add(dcc->handle, G_INPUT_READ,
|
||||
(GInputFunction) sig_dccget_receive, dcc);
|
||||
|
@ -22,7 +22,4 @@ unsigned long transfd; /* bytes transferred */
|
||||
|
||||
unsigned int destroyed:1; /* We're about to destroy this DCC recond */
|
||||
|
||||
char *databuf; /* buffer for receiving/transmitting data */
|
||||
int databufsize;
|
||||
|
||||
GHashTable *module_data;
|
||||
|
@ -54,29 +54,20 @@ static void sig_dcc_destroyed(SEND_DCC_REC *dcc)
|
||||
/* input function: DCC SEND - we're ready to send more data */
|
||||
static void dcc_send_data(SEND_DCC_REC *dcc)
|
||||
{
|
||||
char buffer[512];
|
||||
int ret;
|
||||
|
||||
if (!dcc->fastsend && !dcc->gotalldata) {
|
||||
/* haven't received everything we've send there yet.. */
|
||||
return;
|
||||
}
|
||||
|
||||
ret = read(dcc->fhandle, dcc->databuf, dcc->databufsize);
|
||||
ret = read(dcc->fhandle, buffer, sizeof(buffer));
|
||||
if (ret <= 0) {
|
||||
/* end of file .. or some error .. */
|
||||
if (!dcc->fastsend)
|
||||
dcc_close(DCC(dcc));
|
||||
else {
|
||||
/* no need to call this function anymore..
|
||||
in fact it just eats all the cpu.. */
|
||||
dcc->waitforend = TRUE;
|
||||
g_source_remove(dcc->tagwrite);
|
||||
dcc->tagwrite = -1;
|
||||
}
|
||||
/* no need to call this function anymore..
|
||||
in fact it just eats all the cpu.. */
|
||||
dcc->waitforend = TRUE;
|
||||
g_source_remove(dcc->tagwrite);
|
||||
dcc->tagwrite = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
ret = net_transmit(dcc->handle, dcc->databuf, ret);
|
||||
ret = net_transmit(dcc->handle, buffer, ret);
|
||||
if (ret > 0) dcc->transfd += ret;
|
||||
dcc->gotalldata = FALSE;
|
||||
|
||||
@ -113,11 +104,6 @@ static void dcc_send_read_size(SEND_DCC_REC *dcc)
|
||||
dcc->gotalldata = (long) bytes == dcc->transfd;
|
||||
dcc->count_pos = 0;
|
||||
|
||||
if (!dcc->fastsend) {
|
||||
/* send more data.. */
|
||||
dcc_send_data(dcc);
|
||||
}
|
||||
|
||||
if (dcc->waitforend && dcc->gotalldata) {
|
||||
/* file is sent */
|
||||
dcc_close(DCC(dcc));
|
||||
@ -144,29 +130,17 @@ static void dcc_send_connected(SEND_DCC_REC *dcc)
|
||||
net_disconnect(dcc->handle);
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->fastsend = settings_get_bool("dcc_fast_send");
|
||||
dcc->handle = handle;
|
||||
memcpy(&dcc->addr, &addr, sizeof(IPADDR));
|
||||
net_ip2host(&dcc->addr, dcc->addrstr);
|
||||
dcc->port = port;
|
||||
|
||||
dcc->databufsize = settings_get_int("dcc_block_size");
|
||||
if (dcc->databufsize <= 0) dcc->databufsize = 2048;
|
||||
dcc->databuf = g_malloc(dcc->databufsize);
|
||||
|
||||
dcc->tagread = g_input_add(handle, G_INPUT_READ,
|
||||
(GInputFunction) dcc_send_read_size, dcc);
|
||||
dcc->tagwrite = !dcc->fastsend ? -1 :
|
||||
g_input_add(handle, G_INPUT_WRITE,
|
||||
(GInputFunction) dcc_send_data, dcc);
|
||||
dcc->tagwrite = g_input_add(handle, G_INPUT_WRITE,
|
||||
(GInputFunction) dcc_send_data, dcc);
|
||||
|
||||
signal_emit("dcc connected", 1, dcc);
|
||||
|
||||
if (!dcc->fastsend) {
|
||||
/* send first block */
|
||||
dcc->gotalldata = TRUE;
|
||||
dcc_send_data(dcc);
|
||||
}
|
||||
}
|
||||
|
||||
static char *dcc_send_get_file(const char *fname)
|
||||
@ -271,7 +245,6 @@ static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server,
|
||||
void dcc_send_init(void)
|
||||
{
|
||||
dcc_register_type("SEND");
|
||||
settings_add_bool("dcc", "dcc_fast_send", TRUE);
|
||||
settings_add_str("dcc", "dcc_upload_path", "~");
|
||||
|
||||
signal_add("dcc destroyed", (SIGNAL_FUNC) sig_dcc_destroyed);
|
||||
|
@ -15,7 +15,6 @@ typedef struct {
|
||||
unsigned int file_quoted:1; /* file name was received quoted ("file name") */
|
||||
|
||||
/* fastsending: */
|
||||
unsigned int fastsend:1;
|
||||
unsigned int waitforend:1; /* file is sent, just wait for the replies from the other side */
|
||||
unsigned int gotalldata:1; /* got all acks from the other end (needed to make sure the end of transfer works right) */
|
||||
} SEND_DCC_REC;
|
||||
|
@ -110,7 +110,6 @@ void dcc_destroy(DCC_REC *dcc)
|
||||
|
||||
g_free_not_null(dcc->servertag);
|
||||
g_free_not_null(dcc->target);
|
||||
g_free_not_null(dcc->databuf);
|
||||
g_free(dcc->mynick);
|
||||
g_free(dcc->nick);
|
||||
g_free(dcc->arg);
|
||||
@ -421,7 +420,6 @@ void irc_dcc_init(void)
|
||||
|
||||
settings_add_int("dcc", "dcc_port", 0);
|
||||
settings_add_int("dcc", "dcc_timeout", 300);
|
||||
settings_add_int("dcc", "dcc_block_size", 2048);
|
||||
|
||||
signal_add("server connected", (SIGNAL_FUNC) sig_server_connected);
|
||||
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
|
||||
|
Loading…
x
Reference in New Issue
Block a user