Exemplo n.º 1
0
void RemoveFromFileSource(source_data *source, server_data *serv)
{
    int i;

    if (source->serversn <= 0)
        return;

    for (i=0; i < source->serversn; i++)
        if (!memcmp(&source->servers[i]->address, &serv->address, 6))
        {
            // add to unbound
            AddUnbound(serv);

            // remove from source
            if (i != source->serversn - 1)
            {
                memmove(source->servers+i,
                        source->servers+i+1,
                        (source->serversn - i - 1) * sizeof(source_data *));
            }
            (source->serversn) --;
            DumpSource(source);
            Mark_Source(sources[0]);
            return;
        }
}
Exemplo n.º 2
0
void RemoveFromFileSource(source_data *source, server_data *serv)
{
    int i;
    
    if (source->serversn <= 0)
        return;

    for (i=0; i < source->serversn; i++)
        if (!memcmp(&source->servers[i]->address, &serv->address, 6))
        {
			// Only add to unbound if not in any other sources...
			int j = 0;
			qbool in_other_source = false;
			for (j = 0; j < sourcesn; ++j) {
				if (source != sources[j]) {
					in_other_source |= IsInSource(sources[j], serv);
				}
			}

            // remove from source
            if (i != source->serversn - 1)
            {
                memmove(source->servers+i,
                        source->servers+i+1,
                        (source->serversn - i - 1) * sizeof(source_data *));
            }
            --source->serversn;
            DumpSource(source);
			if (!in_other_source) {
				// add to unbound
				AddUnbound(serv);
				Mark_Source(sources[0]);
			}
            return;
        }
}