From 4fed5ac2a4f172c2f7248c45b4f1f9dc48ed3a05 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 30 Apr 2018 10:05:46 +0200 Subject: ftpd: Fairplay with libbsd Update #3419. --- cpukit/ftpd/ftpd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'cpukit/ftpd') diff --git a/cpukit/ftpd/ftpd.c b/cpukit/ftpd/ftpd.c index 0d4256bc23..3e0ff5d30a 100644 --- a/cpukit/ftpd/ftpd.c +++ b/cpukit/ftpd/ftpd.c @@ -199,6 +199,7 @@ #include #include #include +#include #include #include @@ -305,6 +306,19 @@ static int ftpd_timeout = 0; */ static int ftpd_access = 0; +static void +yield(void) +{ +/* + * If we build not for the legacy network stack, then we use the libbsd. In + * the libbsd there is no global network stack semaphore which provides round + * robin fairness for threads of equal priority. + */ +#ifndef RTEMS_NETWORKING + yield(); +#endif +} + /* * serr * @@ -786,6 +800,7 @@ command_retrieve(FTPD_SessionInfo_t *info, char const *filename) { if(send(s, buf, n, 0) != n) break; + yield(); } } else if (info->xfer_mode == TYPE_A) @@ -821,6 +836,7 @@ command_retrieve(FTPD_SessionInfo_t *info, char const *filename) } } while((rest -= i) > 0); + yield(); } } @@ -1014,6 +1030,7 @@ command_store(FTPD_SessionInfo_t *info, char const *filename) res = 0; break; } + yield(); } } else if(info->xfer_mode == TYPE_A) @@ -1075,6 +1092,7 @@ command_store(FTPD_SessionInfo_t *info, char const *filename) res = 0; } while((rest -= i) > 0); + yield(); } } -- cgit v1.2.3