[pan2] giganews commit
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] giganews commit
- Date: Wed, 6 Feb 2013 16:38:34 +0000 (UTC)
commit 2e9e07c1bdcaeb503db9d9e6a9bc63ab6cb87ae1
Author: Heinrich MÃller <henmull src gnome org>
Date: Wed Feb 6 17:38:22 2013 +0100
giganews commit
pan/general/compression.cc | 7 -------
pan/tasks/nntp.cc | 27 +++++++++++++--------------
pan/tasks/nntp.h | 1 -
pan/tasks/socket-impl-gio.cc | 4 ----
pan/tasks/socket-impl-openssl.cc | 1 -
pan/tasks/socket.h | 1 -
pan/tasks/task-groups.cc | 3 ++-
7 files changed, 15 insertions(+), 29 deletions(-)
---
diff --git a/pan/general/compression.cc b/pan/general/compression.cc
index 70ad141..5c02125 100644
--- a/pan/general/compression.cc
+++ b/pan/general/compression.cc
@@ -140,7 +140,6 @@ compression::ydecode(std::stringstream* in, std::stringstream* out)
else if (gotbeg == 1 && strncmp(buf1, "=yend ", 6) == 0)
{
p = strstr(buf1, "crc32=");
- std::cerr<<"crc loop "<<p<<"\n";
if (p)
sscanf(p + 6, "%x", &crc1);
break;
@@ -282,8 +281,6 @@ void compression::inflate_gzip (std::stringstream* stream, std::vector<std::stri
}
}
- std::cerr<<"inflate : "<<inflate_zlib(&dest, &dest2, HEADER_COMPRESS_XFEATURE)<<"\n\n";
-
std::ofstream out ("/home/imhotep/compression/out");
out << dest2.str();
out.close();
@@ -295,8 +292,4 @@ void compression::inflate_gzip (std::stringstream* stream, std::vector<std::stri
stream->clear();
- std::cerr<<cnt<<"\n";
-
-
-
}
diff --git a/pan/tasks/nntp.cc b/pan/tasks/nntp.cc
index 1127960..7c434a6 100644
--- a/pan/tasks/nntp.cc
+++ b/pan/tasks/nntp.cc
@@ -74,6 +74,10 @@ NNTP :: fire_done_func (Health health, const StringView& response)
bool
NNTP :: on_socket_response (Socket * sock UNUSED, const StringView& line_in)
{
+
+ //increase dl meter
+ _meter.dl_meter_add (line_in.len);
+
enum State { CMD_FAIL, CMD_DONE, CMD_MORE, CMD_NEXT, CMD_RETRY };
State state;
StringView line (line_in);
@@ -89,7 +93,7 @@ NNTP :: on_socket_response (Socket * sock UNUSED, const StringView& line_in)
state = CMD_DONE;
_nntp_response_text = false;
}
- else if (!_compression)
+ else
{
state = CMD_MORE;
@@ -103,13 +107,11 @@ NNTP :: on_socket_response (Socket * sock UNUSED, const StringView& line_in)
if (_compression)
{
- state = CMD_MORE;
- assert (_listener != 0);
- if (_listener)
- _listener->on_nntp_line (this, line_in);
- if (line_in.len >= 3 && strncmp(line_in.str + line_in.len - 3, ".\r\n", 3) == 0)
+ if (line_in.len >= 3 &&
+ strncmp(line_in.str + line_in.len - 3, ".\r\n", 3) == 0)
{
_nntp_response_text = false;
+ _compression = false;
line = EOL;
state = CMD_DONE;
}
@@ -117,8 +119,9 @@ NNTP :: on_socket_response (Socket * sock UNUSED, const StringView& line_in)
}
else
{
- //check for compression
- _compression = strcasestr (line_in.str, COMPRESS_GZIP);
+ //check for compression, enable once, disable at end
+ if (!_compression)
+ _compression = strcasestr (line_in.str, COMPRESS_GZIP);
switch (atoi (line.str))
{
@@ -297,12 +300,7 @@ NNTP :: on_socket_error (Socket * sock UNUSED)
fire_done_func (ERR_NETWORK, StringView());
}
-void
-NNTP :: on_socket_bytes_transferred (uint64_t bytes, Socket*)
-{
- _meter.dl_meter_add (bytes);
-}
-
+/*
namespace
{
void
@@ -312,6 +310,7 @@ namespace
g_string_append (g, "\r\n");
}
};
+*/
void
NNTP :: write_next_command ()
diff --git a/pan/tasks/nntp.h b/pan/tasks/nntp.h
index eccab45..7ac6469 100644
--- a/pan/tasks/nntp.h
+++ b/pan/tasks/nntp.h
@@ -358,7 +358,6 @@ namespace pan
virtual bool on_socket_response (Socket*, const StringView& line);
virtual void on_socket_error (Socket*);
virtual void on_socket_abort (Socket*);
- virtual void on_socket_bytes_transferred (uint64_t bytes, Socket*) ;
public:
diff --git a/pan/tasks/socket-impl-gio.cc b/pan/tasks/socket-impl-gio.cc
index afeb1a3..1752319 100644
--- a/pan/tasks/socket-impl-gio.cc
+++ b/pan/tasks/socket-impl-gio.cc
@@ -343,11 +343,7 @@ GIOChannelSocket :: do_read ()
debug_v ("read [" << g->str << "]"); // verbose debug, if --debug --debug was on the command-line
increment_xfer_byte_count (g->len);
- //if (g_str_has_suffix (g->str, "\r\n"))
- // g_string_truncate (g, g->len-2);
-
more = _listener->on_socket_response (this, StringView (g->str, g->len));
- _listener->on_socket_bytes_transferred(g->len, this);
}
else if (status == G_IO_STATUS_AGAIN)
{
diff --git a/pan/tasks/socket-impl-openssl.cc b/pan/tasks/socket-impl-openssl.cc
index 2b33479..e2fcb5e 100644
--- a/pan/tasks/socket-impl-openssl.cc
+++ b/pan/tasks/socket-impl-openssl.cc
@@ -626,7 +626,6 @@ GIOChannelSocketGnuTLS :: do_read ()
//if (g_str_has_suffix (g->str, "\r\n"))
// g_string_truncate (g, g->len-2);
more = _listener->on_socket_response (this, StringView (g->str, g->len));
- //_listener->on_socket_bytes_transferred(g->len, this);
}
else if (status == G_IO_STATUS_AGAIN)
{
diff --git a/pan/tasks/socket.h b/pan/tasks/socket.h
index 3e46874..2609e92 100644
--- a/pan/tasks/socket.h
+++ b/pan/tasks/socket.h
@@ -62,7 +62,6 @@ namespace pan
virtual bool on_socket_response (Socket*, const StringView& line) = 0;
virtual void on_socket_error (Socket*) = 0;
virtual void on_socket_abort (Socket*) = 0;
- virtual void on_socket_bytes_transferred (uint64_t bytes, Socket*) = 0;
};
public:
diff --git a/pan/tasks/task-groups.cc b/pan/tasks/task-groups.cc
index fffb701..d0ad676 100644
--- a/pan/tasks/task-groups.cc
+++ b/pan/tasks/task-groups.cc
@@ -79,8 +79,9 @@ void
TaskGroups :: on_nntp_line (NNTP * nntp,
const StringView & line)
{
+ // gzip compression
if (nntp->_compression)
- stream<<line;
+ stream<<line<<"\r\n";
else on_nntp_line_process (nntp, line);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]