diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-30 10:05:46 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-05-02 09:56:48 +0200 |
commit | 4fed5ac2a4f172c2f7248c45b4f1f9dc48ed3a05 (patch) | |
tree | 5ff375188a97973de234f37f5398322eb10150cb | |
parent | network: Import latest <arpa/ftp.h> from FreeBSD (diff) | |
download | rtems-4fed5ac2a4f172c2f7248c45b4f1f9dc48ed3a05.tar.bz2 |
ftpd: Fairplay with libbsd
Update #3419.
-rw-r--r-- | cpukit/ftpd/ftpd.c | 18 |
1 files changed, 18 insertions, 0 deletions
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 <errno.h> #include <ctype.h> #include <inttypes.h> +#include <sched.h> #include <rtems.h> #include <rtems/rtems_bsdnet.h> @@ -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(); } } |