Remove a useless loop in mud_send()

This commit is contained in:
Adrien Gallouët
2017-01-12 10:11:04 +00:00
parent 2d171c6dd9
commit 58c734a681

17
mud.c
View File

@@ -1224,11 +1224,15 @@ mud_send(struct mud *mud, const void *data, size_t size, int tc)
struct mud_path *path; struct mud_path *path;
struct mud_path *path_min = NULL; struct mud_path *path_min = NULL;
struct mud_path *path_backup = NULL;
int64_t limit_min = INT64_MAX; int64_t limit_min = INT64_MAX;
for (path = mud->path; path; path = path->next) { for (path = mud->path; path; path = path->next) {
if (path->state.backup) if (path->state.backup) {
path_backup = path;
continue; continue;
}
int64_t limit = path->limit; int64_t limit = path->limit;
uint64_t elapsed = now - path->send_time; uint64_t elapsed = now - path->send_time;
@@ -1252,15 +1256,10 @@ mud_send(struct mud *mud, const void *data, size_t size, int tc)
} }
if (!path_min) { if (!path_min) {
for (path = mud->path; path; path = path->next) { if (!path_backup)
if (path->state.backup) {
path_min = path;
break;
}
}
if (!path_min)
return 0; return 0;
path_min = path_backup;
} }
ssize_t ret = mud_send_path(mud, path_min, now, packet, packet_size, tc); ssize_t ret = mud_send_path(mud, path_min, now, packet, packet_size, tc);