int UpdatePeerData(PTorrentInfo torrent)
{
    PPeerInfo pi;
	Peers *p = torrent->peers;
	time_t curr = time(NULL);
	torrent->seed_count = 0;
	torrent->leech_count = 0;
    Peers::iterator it =  p->begin();
    while (it != p->end()) {
        pi = *it;
        if ((time_t)(pi->last_announce + INACTIVE_TIMEOUT) < curr) {
        	it = p->erase(it);
        } else {
	        if (pi->bytesleft == 0) { torrent->seed_count++; }
        	 else { torrent->leech_count++; }
	        ++it;
        }
    }//for
	return TRUE;
}
void ChannelServerApp::disconnect( const Mercury::Address & srcAddr,
		const ServerInterface::disconnectArgs & args )
{
	Peers::iterator peerIter = peers_.find( srcAddr );

	if (peerIter != peers_.end())
	{
		peerIter->second->disconnect( args.seq );
		peers_.erase( peerIter );

		if (peers_.empty())
		{
			this->nub().breakProcessing();
		}
	}
	else
	{
		ERROR_MSG( "ChannelServerApp::disconnectArgs: "
				"Got message from unknown peer at %s\n",
			srcAddr.c_str() );
	}
}