Pause timeout when in a door, so it doesn't disconnect immediatly on return
This commit is contained in:
parent
fa3b1237be
commit
5ff9abd99e
6
bbs.c
6
bbs.c
@ -19,6 +19,7 @@ struct user_record *gUser;
|
||||
int gSocket;
|
||||
|
||||
int usertimeout;
|
||||
int timeoutpaused;
|
||||
|
||||
struct fido_addr *parse_fido_addr(const char *str) {
|
||||
struct fido_addr *ret = (struct fido_addr *)malloc(sizeof(struct fido_addr));
|
||||
@ -89,7 +90,9 @@ void timer_handler(int signum) {
|
||||
|
||||
|
||||
}
|
||||
usertimeout--;
|
||||
if (timeoutpaused == 0) {
|
||||
usertimeout--;
|
||||
}
|
||||
if (usertimeout <= 0) {
|
||||
s_putstring(gSocket, "\r\n\r\nTimeout waiting for input..\r\n");
|
||||
disconnect(gSocket);
|
||||
@ -682,6 +685,7 @@ void runbbs(int socket, char *config_path) {
|
||||
gUser = NULL;
|
||||
gSocket = socket;
|
||||
usertimeout = 10;
|
||||
timeoutpaused = 0;
|
||||
|
||||
memset (&sa, 0, sizeof (sa));
|
||||
sa.sa_handler = &timer_handler;
|
||||
|
5
doors.c
5
doors.c
@ -23,6 +23,8 @@ extern int mynode;
|
||||
int running_door_pid = 0;
|
||||
int running_door = 0;
|
||||
|
||||
extern int timeoutpaused;
|
||||
|
||||
void doorchld_handler(int s)
|
||||
{
|
||||
// waitpid() might overwrite errno, so we save and restore it:
|
||||
@ -136,6 +138,8 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) {
|
||||
struct winsize ws;
|
||||
struct sigaction sa;
|
||||
|
||||
timeoutpaused = 1;
|
||||
|
||||
if (write_door32sys(socket, user) != 0) {
|
||||
return;
|
||||
}
|
||||
@ -223,6 +227,7 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) {
|
||||
sprintf(buffer, "%s %d %d", cmd, mynode, socket);
|
||||
system(buffer);
|
||||
}
|
||||
timeoutpaused = 0;
|
||||
}
|
||||
|
||||
int door_menu(int socket, struct user_record *user) {
|
||||
|
Reference in New Issue
Block a user