diff options
author | Timo Sirainen <cras@irssi.org> | 2001-02-19 03:40:06 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-02-19 03:40:06 +0000 |
commit | 19dff227d804e17c85afb38e3621cd60856bc50e (patch) | |
tree | 379b16b08c29151bc62686435bad937deb200fa3 | |
parent | c1c7674ae2eee9be7717394f9eab66c0f01db63e (diff) | |
download | irssi-19dff227d804e17c85afb38e3621cd60856bc50e.zip |
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
-rw-r--r-- | src/irc/dcc/dcc-chat.c | 5 | ||||
-rw-r--r-- | src/irc/dcc/dcc-chat.h | 1 | ||||
-rw-r--r-- | src/irc/dcc/dcc-get.c | 9 | ||||
-rw-r--r-- | src/irc/dcc/dcc-rec.h | 3 | ||||
-rw-r--r-- | src/irc/dcc/dcc-send.c | 47 | ||||
-rw-r--r-- | src/irc/dcc/dcc-send.h | 1 | ||||
-rw-r--r-- | src/irc/dcc/dcc.c | 2 |
7 files changed, 16 insertions, 52 deletions
diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c index eda25211..a43ac6fa 100644 --- a/src/irc/dcc/dcc-chat.c +++ b/src/irc/dcc/dcc-chat.c @@ -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; diff --git a/src/irc/dcc/dcc-chat.h b/src/irc/dcc/dcc-chat.h index c8f2cea9..62cb771f 100644 --- a/src/irc/dcc/dcc-chat.h +++ b/src/irc/dcc/dcc-chat.h @@ -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 */ diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index c1596afa..df51c837 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -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); diff --git a/src/irc/dcc/dcc-rec.h b/src/irc/dcc/dcc-rec.h index 5f6d5178..02cde37c 100644 --- a/src/irc/dcc/dcc-rec.h +++ b/src/irc/dcc/dcc-rec.h @@ -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; diff --git a/src/irc/dcc/dcc-send.c b/src/irc/dcc/dcc-send.c index 828b12e3..ebd155c6 100644 --- a/src/irc/dcc/dcc-send.c +++ b/src/irc/dcc/dcc-send.c @@ -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); diff --git a/src/irc/dcc/dcc-send.h b/src/irc/dcc/dcc-send.h index 493b4cd8..378f1c54 100644 --- a/src/irc/dcc/dcc-send.h +++ b/src/irc/dcc/dcc-send.h @@ -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; diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c index 93a51b7a..7b07e5d3 100644 --- a/src/irc/dcc/dcc.c +++ b/src/irc/dcc/dcc.c @@ -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); |