Example #1
0
/* Remove a host from the template list, give the reason as r and decrement
nA.  If r is the empty string, no message will be printed. */
func removeHost(ts *tslist.List, a attempt, r string, nA *lockedint.TInt) {
	/* Tell the user what's going on */
	if r != "" {
		log.Printf("[%v] Removing %v from attack queue: %v", a.Tasknum,
			a.Host, r)
	}
	/* Mark a bunch of hosts for removal */
	for e := ts.Head(); e != nil; e = e.Next() {
		if c, ok := e.Value().(*template); !ok {
			printTemplateNotOk(e)
			os.Exit(-10)
		} else if ok && c.Host == a.Host {
			e.RemoveMark()
		}
	}
	/* Remove the marked hosts */
	ts.RemoveMarked()
	/* Decrement the number of attempts in the wild */
	nA.Dec()
}