~ Most simple search functions start with find_; in this case, search * for an existing attempt to connect the given peer id. */
| 146 | /*~ Most simple search functions start with find_; in this case, search |
| 147 | * for an existing attempt to connect the given peer id. */ |
| 148 | static struct connecting *find_connecting(struct daemon *daemon, |
| 149 | const struct node_id *id) |
| 150 | { |
| 151 | struct connecting *i; |
| 152 | |
| 153 | /*~ Note the node_id_eq function: this is generally preferred over |
| 154 | * doing a memcmp() manually, as it is both typesafe and can handle |
| 155 | * any padding which the C compiler is allowed to insert between |
| 156 | * members (unnecessary here, as there's no padding in a `struct |
| 157 | * node_id`). */ |
| 158 | list_for_each(&daemon->connecting, i, list) |
| 159 | if (node_id_eq(id, &i->id)) |
| 160 | return i; |
| 161 | return NULL; |
| 162 | } |
| 163 | |
| 164 | /*~ Once we've connected out, we disable the callback which would cause us to |
| 165 | * to try the next address. */ |
no test coverage detected