Added size output for campaign list too

This commit is contained in:
Pauli Nieminen 2008-08-06 15:11:06 +00:00
parent ce41f025a2
commit 5a454f874d
3 changed files with 4 additions and 4 deletions

View file

@ -319,7 +319,7 @@ namespace {
config data;
while((sock = network::receive_data(data, 0, &gzipped)) != network::null_connection) {
if(const config* req = data.child("request_campaign_list")) {
LOG_CS << "sending campaign list to " << network::ip_address(sock) << (gzipped?" using gzip":"") << "\n";
LOG_CS << "sending campaign list to " << network::ip_address(sock) << (gzipped?" using gzip":"");
time_t epoch = time(NULL);
config campaign_list;
(campaign_list)["timestamp"] = lexical_cast<std::string>(epoch);
@ -374,7 +374,7 @@ namespace {
config response;
response.add_child("campaigns",campaign_list);
network::send_data(response, sock, gzipped);
std::cerr << " size: " << (network::send_data(response, sock, gzipped)/1024) << "kb\n";
} else if(const config* req = data.child("request_campaign")) {
LOG_CS << "sending campaign '" << (*req)["name"] << "' to " << network::ip_address(sock) << (gzipped?" using gzip":"");
config* const campaign = campaigns().find_child("campaign","name",(*req)["name"]);

View file

@ -139,7 +139,7 @@ void send_file(const std::string&, connection);
//! Function to send data down a given connection,
//! or broadcast to all peers if connection_num is 0.
//! Throws error.
void send_data(const config& cfg, connection connection_num /*= 0*/, const bool gzipped);
size_t send_data(const config& cfg, connection connection_num /*= 0*/, const bool gzipped);
void send_raw_data(const char* buf, int len, connection connection_num);

View file

@ -59,7 +59,7 @@ TCPsocket get_received_data(std::vector<char>& buf);
void queue_file(TCPsocket sock, const std::string&);
void queue_raw_data(TCPsocket sock, const char* buf, int len);
void queue_data(TCPsocket sock, const config& buf, const bool gzipped);
size_t queue_data(TCPsocket sock, const config& buf, const bool gzipped);
bool is_locked(const TCPsocket sock);
bool close_socket(TCPsocket sock, bool force=false);
TCPsocket detect_error();