add: */
context: int main(int argc, char* argv[]){	using namespace libtorrent;	// TEMPORARY//	boost::filesystem::path::default_name_check(boost::filesystem::no_check);	if (argc < 2)	{		std::cerr << "usage: ./client_test torrent-files ...\n"			"to stop the client, press q.\n";		return 1;	}	http_settings settings;//	settings.proxy_ip = "192.168.0.1";//	settings.proxy_port = 80;//	settings.proxy_login = "hyd";//	settings.proxy_password = "foobar";	settings.user_agent = "example";	try	{		std::vector<torrent_handle> handles;		session s(6881, "E\x1");		// limit upload rate to 100 kB/s//		s.set_upload_rate_limit(100 * 1024);		s.set_http_settings(settings);		for (int i = 0; i < argc-1; ++i)		{			try			{				std::ifstream in(argv[i+1], std::ios_base::binary);				in.unsetf(std::ios_base::skipws);				entry e = bdecode(std::istream_iterator<char>(in), std::istream_iterator<char>());				torrent_info t(e);				t.print(std::cout);				handles.push_back(s.add_torrent(t, ""));			}			catch (std::exception& e)			{				std::cout << e.what() << "\n";			}		}		std::vector<peer_info> peers;		std::vector<partial_piece_info> queue;		for (;;)		{			char c;			if (sleep_and_input(&c))			{				if (c == 'q') break;			}			std::stringstream out;			for (std::vector<torrent_handle>::iterator i = handles.begin();				i != handles.end();				++i)			{				torrent_status s = i->status();				switch(s.state)				{					case torrent_status::queued_for_checking:						out << "queued ";						break;					case torrent_status::checking_files:						out << "checking ";						break;					case torrent_status::downloading:						out << "dloading ";						break;					case torrent_status::seeding:						out << "seeding ";						break;				};				// calculate download and upload speeds				i->get_peer_info(peers);				float down = s.download_rate;				float up = s.upload_rate;				int total_down = s.total_download;				int total_up = s.total_upload;				int num_peers = peers.size();/*				std::cout << boost::format("%f%% p:%d d:(%s) %s/s u:(%s) %s/s\n")					% (s.progress*100)					% num_peers					% add_suffix(total_down)					% add_suffix(down)					% add_suffix(total_up)					% add_suffix(up);*/				out.precision(4);				out.width(5);				out.fill(' ');				out << (s.progress*100) << "% ";				for (int i = 0; i < 50; ++i)				{					if (i / 50.f > s.progress)						out << "-";					else						out << "#";				}				out << "\n";				out << "peers: " << num_peers << " "					<< "d:" << add_suffix(down) << "/s "					<< "(" << add_suffix(total_down) << ") "					<< "u:" << add_suffix(up) << "/s "					<< "(" << add_suffix(total_up) << ") "					<< "diff: " << add_suffix(total_down - total_up) << "\n";				boost::posix_time::time_duration t = s.next_announce;//				std::cout << "next announce: " << boost::posix_time::to_simple_string(t) << "\n";				out << "next announce: " << t.hours() << ":" << t.minutes() << ":" << t.seconds() << "\n";				for (std::vector<peer_info>::iterator i = peers.begin();					i != peers.end();					++i)				{					out << "d: " << add_suffix(i->down_speed) << "/s "						<< "(" << add_suffix(i->total_download) << ") "						<< "u: " << add_suffix(i->up_speed) << "/s "						<< "(" << add_suffix(i->total_upload) << ") "						<< "df: " << add_suffix((int)i->total_download - (int)i->total_upload) << " "						<< "l: " << add_suffix(i->upload_ceiling) << "/s "						<< "f: "						<< static_cast<const char*>((i->flags & peer_info::interesting)?"I":"_")						<< static_cast<const char*>((i->flags & peer_info::choked)?"C":"_")						<< static_cast<const char*>((i->flags & peer_info::remote_interested)?"i":"_")						<< static_cast<const char*>((i->flags & peer_info::remote_choked)?"c":"_") << "\n";				}				out << "___________________________________\n";				i->get_download_queue(queue);				for (std::vector<partial_piece_info>::iterator i = queue.begin();					i != queue.end();					++i)				{					out.width(4);					out.fill(' ');					out << i->piece_index << ": |";					for (int j = 0; j < i->blocks_in_piece; ++j)					{						if (i->finished_blocks[j]) out << "#";						else if (i->requested_blocks[j]) out << "=";						else out << "-";					}					out << "|\n";				}				out << "___________________________________\n";			}			clear();			set_cursor(0, 0);			std::cout << out.str();		}	}	catch (std::exception& e)	{  		std::cout << e.what() << "\n";	}	return 0;}