~ubuntu-branches/ubuntu/quantal/aria2/quantal

« back to all changes in this revision

Viewing changes to src/ServerStat.cc

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry
  • Date: 2011-11-08 20:25:08 UTC
  • mfrom: (2.5.7 sid)
  • Revision ID: package-import@ubuntu.com-20111108202508-scfph8rj6tz0cckk
Tags: 1.13.0-1
* New upstream version:
  + Depends on libgcrypt11 (>= 1.5.0-3) (Closes: #642989)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include "Logger.h"
42
42
#include "LogFactory.h"
43
43
#include "fmt.h"
 
44
#include "a2functional.h"
 
45
#include "util.h"
44
46
 
45
47
namespace aria2 {
46
48
 
186
188
 
187
189
void ServerStat::setError()
188
190
{
189
 
  setStatusInternal(ERROR);
 
191
  setStatusInternal(A2_ERROR);
190
192
}
191
193
 
192
194
bool ServerStat::operator<(const ServerStat& serverStat) const
204
206
  return hostname_ == serverStat.hostname_ && protocol_ == serverStat.protocol_;
205
207
}
206
208
 
207
 
std::ostream& operator<<(std::ostream& o, const ServerStat& serverStat)
 
209
std::string ServerStat::toString() const
208
210
{
209
 
  o << "host=" << serverStat.getHostname() << ", "
210
 
    << "protocol=" << serverStat.getProtocol() << ", "
211
 
    << "dl_speed=" << serverStat.getDownloadSpeed() << ", "
212
 
    << "sc_avg_speed=" << serverStat.getSingleConnectionAvgSpeed() << ", "
213
 
    << "mc_avg_speed=" << serverStat.getMultiConnectionAvgSpeed() << ", "
214
 
    << "last_updated=" << serverStat.getLastUpdated().getTime() << ", "
215
 
    << "counter=" << serverStat.getCounter() << ", "
216
 
    << "status=" << ServerStat::STATUS_STRING[serverStat.getStatus()];
217
 
  return o;
 
211
  std::string res;
 
212
  strappend(res, "host=", getHostname(), ", ");
 
213
  strappend(res, "protocol=", getProtocol(), ", ");
 
214
  strappend(res, "dl_speed=", util::uitos(getDownloadSpeed()), ", ");
 
215
  strappend(res, "sc_avg_speed=", util::uitos(getSingleConnectionAvgSpeed()),
 
216
            ", ");
 
217
  strappend(res, "mc_avg_speed=", util::uitos(getMultiConnectionAvgSpeed()),
 
218
            ", ");
 
219
  strappend(res, "last_updated=", util::itos(getLastUpdated().getTime()), ", ");
 
220
  strappend(res, "counter=", util::uitos(getCounter()), ", ");
 
221
  strappend(res, "status=", ServerStat::STATUS_STRING[getStatus()]);
 
222
  return res;
218
223
}
219
224
 
220
225
} // namespace aria2