mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Eliminated first time connect delay
Rearranged timeout handling so that the first time connect delay is eliminated.
This commit is contained in:
parent
11458f3707
commit
0ad8007aac
1 changed files with 5 additions and 8 deletions
13
src/tty.c
13
src/tty.c
|
|
@ -52,7 +52,11 @@ void wait_for_tty_device(void)
|
||||||
/* Loop until device pops up */
|
/* Loop until device pops up */
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
/* Wait up to 1 seconds */
|
/* Test for device file */
|
||||||
|
if (stat(option.tty_device, &status) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Wait up to 1 second */
|
||||||
tv.tv_sec = 1;
|
tv.tv_sec = 1;
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
|
|
@ -73,13 +77,6 @@ void wait_for_tty_device(void)
|
||||||
c_stdin[1] = c_stdin[0];
|
c_stdin[1] = c_stdin[0];
|
||||||
if ((c_stdin[1] == KEY_Q) && (c_stdin[2] == KEY_CTRL_G))
|
if ((c_stdin[1] == KEY_Q) && (c_stdin[2] == KEY_CTRL_G))
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
} else
|
|
||||||
{
|
|
||||||
/* Timeout */
|
|
||||||
|
|
||||||
/* Test for device file */
|
|
||||||
if (stat(option.tty_device, &status) == 0)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue