mirror of
https://github.com/bstansell/conserver.git
synced 2025-01-27 06:09:19 +00:00
wrap usleep()/nanosleep() with Sleep() based on configure findings
This commit is contained in:
parent
3d3b5b7c44
commit
62dba066e1
@ -850,7 +850,7 @@ AC_CHECK_HEADERS(pty.h libutil.h util.h)
|
||||
AC_CHECK_LIB(util, openpty)
|
||||
AC_CHECK_FUNCS(openpty)
|
||||
|
||||
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle gettimeofday strlcpy closefrom)
|
||||
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt sigaction setsockopt getdtablesize putenv memset memcpy memcmp memmove sysconf getlogin inet_aton setproctitle gettimeofday strlcpy closefrom nanosleep)
|
||||
AC_CHECK_FUNC(strcasecmp,
|
||||
[AC_DEFINE(HAVE_STRCASECMP, 1, [Define if strcasecmp is available])],
|
||||
[AC_CHECK_FUNC(stricmp,
|
||||
|
@ -820,8 +820,7 @@ ConsInit(CONSENT *pCE)
|
||||
*/
|
||||
if (pCE->fup) {
|
||||
ConsDown(pCE, FLAGFALSE, FLAGTRUE);
|
||||
struct timespec t = {0, 250 * 1000 * 1000};
|
||||
nanosleep(&t, NULL); /* pause 0.25 sec to let things settle a bit */
|
||||
Sleep(250000);
|
||||
}
|
||||
|
||||
pCE->autoReUp = 0;
|
||||
@ -886,9 +885,7 @@ ConsInit(CONSENT *pCE)
|
||||
#if HAVE_SETSOCKOPT
|
||||
int one = 1;
|
||||
#endif
|
||||
struct timespec t = {0, 100 * 1000 * 1000};
|
||||
|
||||
nanosleep(&t, NULL); /* Not all terminal servers can keep up */
|
||||
Sleep(100000); /* Not all terminal servers can keep up */
|
||||
|
||||
#if USE_IPV6
|
||||
# if HAVE_MEMSET
|
||||
|
@ -3091,3 +3091,14 @@ StrCpy(char *dst, const char *src, unsigned int size)
|
||||
strcpy(dst, src);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Sleep(useconds_t usec)
|
||||
{
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
struct timespec ts = {0, usec * 1000};
|
||||
nanosleep(&ts, NULL);
|
||||
#else
|
||||
usleep(usec);
|
||||
#endif
|
||||
}
|
||||
|
@ -215,6 +215,7 @@ extern void ProcessSubst(SUBST *, char **, char **, char *, char *);
|
||||
extern char *MyVersion(void);
|
||||
extern unsigned int AtoU(char *);
|
||||
extern void StrCpy(char *, const char *, unsigned int);
|
||||
extern void Sleep(useconds_t);
|
||||
#if HAVE_OPENSSL
|
||||
extern SSL *FileGetSSL(CONSFILE *);
|
||||
extern void FileSetSSL(CONSFILE *, SSL *);
|
||||
|
@ -4211,12 +4211,10 @@ FlushConsole(CONSENT *pCEServing)
|
||||
}
|
||||
*/
|
||||
CONDDEBUG((1,
|
||||
"Kiddie(): heavy IAC - doing usleep() for [%s] (break #%c - delay %dms)",
|
||||
"Kiddie(): heavy IAC - doing Sleep() for [%s] (break #%c - delay %dms)",
|
||||
pCEServing->server, next, delay));
|
||||
if (delay != 0) {
|
||||
struct timespec d = {0, delay * 1000 * 1000};
|
||||
nanosleep(&d, NULL);
|
||||
}
|
||||
if (delay != 0)
|
||||
Sleep(delay * 1000);
|
||||
} else if (next == BREAK) {
|
||||
CONDDEBUG((1,
|
||||
"Kiddie(): heavy IAC - sending break for [%s]",
|
||||
@ -4248,7 +4246,7 @@ FlushConsole(CONSENT *pCEServing)
|
||||
}
|
||||
/* we do this 'cause we just potentially paused for
|
||||
* a half-second doing a break...or even the
|
||||
* intentional usleep(). we could take out the
|
||||
* intentional Sleep(). we could take out the
|
||||
* justHadDelay bits and continue with the stream,
|
||||
* but this allows us to process other consoles and
|
||||
* then come around and do more on this one. you
|
||||
@ -5252,8 +5250,7 @@ Spawn(GRPENT *pGE, int msfd)
|
||||
* possibly opens another socket to the port. this really is only
|
||||
* an issue if you use the same port with -p and -b, i think.
|
||||
*/
|
||||
struct timespec s = {0, 750 * 1000 * 1000};
|
||||
nanosleep(&s, NULL); /* pause 0.75 sec to throttle startup a bit */
|
||||
Sleep(750000); /* pause 0.75 sec to throttle startup a bit */
|
||||
pGE->pid = pid;
|
||||
return;
|
||||
case 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user