mirror of
https://github.com/bstansell/conserver.git
synced 2025-04-15 06:36:42 +00:00
Merge pull request #53 from bstansell/nanosleep
usleep()/nanosleep() wrapper - based on contribution by Rosen Penev <rosenp@gmail.com>
This commit is contained in:
commit
5935a7984e
@ -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,7 +820,7 @@ ConsInit(CONSENT *pCE)
|
||||
*/
|
||||
if (pCE->fup) {
|
||||
ConsDown(pCE, FLAGFALSE, FLAGTRUE);
|
||||
usleep(250000); /* pause 0.25 sec to let things settle a bit */
|
||||
Sleep(250000);
|
||||
}
|
||||
|
||||
pCE->autoReUp = 0;
|
||||
@ -885,8 +885,7 @@ ConsInit(CONSENT *pCE)
|
||||
#if HAVE_SETSOCKOPT
|
||||
int one = 1;
|
||||
#endif
|
||||
|
||||
usleep(100000); /* 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,10 +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)
|
||||
usleep(delay * 1000);
|
||||
Sleep(delay * 1000);
|
||||
} else if (next == BREAK) {
|
||||
CONDDEBUG((1,
|
||||
"Kiddie(): heavy IAC - sending break for [%s]",
|
||||
@ -4246,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
|
||||
@ -5250,7 +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.
|
||||
*/
|
||||
usleep(750000); /* 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