Add and use a DropClient() function for closing the diagnostic port.
Call DropClient() from Cleanup() too.
This commit is contained in:
parent
d692b6bcbf
commit
cb499269d8
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: command.c,v 1.101 1997/11/12 18:47:28 brian Exp $
|
* $Id: command.c,v 1.102 1997/11/13 14:43:14 brian Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -781,27 +781,12 @@ TerminalCommand(struct cmdtab const * list, int argc, char **argv)
|
|||||||
static int
|
static int
|
||||||
QuitCommand(struct cmdtab const * list, int argc, char **argv)
|
QuitCommand(struct cmdtab const * list, int argc, char **argv)
|
||||||
{
|
{
|
||||||
FILE *oVarTerm;
|
if (VarTerm) {
|
||||||
|
DropClient();
|
||||||
if (mode & MODE_INTER)
|
if (mode & MODE_INTER)
|
||||||
Cleanup(EX_NORMAL);
|
Cleanup(EX_NORMAL);
|
||||||
else if (argc > 0 && !strcasecmp(*argv, "all") &&
|
else if (argc > 0 && !strcasecmp(*argv, "all") && VarLocalAuth&LOCAL_AUTH)
|
||||||
(VarLocalAuth & LOCAL_AUTH)) {
|
Cleanup(EX_NORMAL);
|
||||||
oVarTerm = VarTerm;
|
|
||||||
VarTerm = 0;
|
|
||||||
if (oVarTerm && oVarTerm != stdout)
|
|
||||||
fclose(oVarTerm);
|
|
||||||
close(netfd);
|
|
||||||
netfd = -1;
|
|
||||||
Cleanup(EX_NORMAL);
|
|
||||||
} else if (VarTerm) {
|
|
||||||
LogPrintf(LogPHASE, "Client connection closed.\n");
|
|
||||||
oVarTerm = VarTerm;
|
|
||||||
VarTerm = 0;
|
|
||||||
if (oVarTerm && oVarTerm != stdout)
|
|
||||||
fclose(oVarTerm);
|
|
||||||
close(netfd);
|
|
||||||
netfd = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: defs.c,v 1.2 1997/11/11 22:58:10 brian Exp $
|
* $Id: defs.c,v 1.3 1997/11/17 00:42:38 brian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -69,3 +69,19 @@ GetShortHost()
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DropClient()
|
||||||
|
{
|
||||||
|
FILE *oVarTerm;
|
||||||
|
|
||||||
|
if (VarTerm && !(mode & MODE_INTER)) {
|
||||||
|
oVarTerm = VarTerm;
|
||||||
|
VarTerm = 0;
|
||||||
|
if (oVarTerm)
|
||||||
|
fclose(oVarTerm);
|
||||||
|
close(netfd);
|
||||||
|
netfd = -1;
|
||||||
|
LogPrintf(LogPHASE, "Client connection closed.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: defs.h,v 1.25 1997/11/11 22:58:10 brian Exp $
|
* $Id: defs.h,v 1.26 1997/11/17 00:42:39 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -91,3 +91,4 @@ extern void SetLabel(const char *);
|
|||||||
extern const char *GetLabel(void);
|
extern const char *GetLabel(void);
|
||||||
extern void randinit(void);
|
extern void randinit(void);
|
||||||
extern int GetShortHost(void);
|
extern int GetShortHost(void);
|
||||||
|
extern void DropClient(void);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: main.c,v 1.100 1997/11/17 00:42:40 brian Exp $
|
* $Id: main.c,v 1.101 1997/11/17 01:13:41 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* o Add commands for traffic summary, version display, etc.
|
* o Add commands for traffic summary, version display, etc.
|
||||||
@ -180,6 +180,7 @@ TtyOldMode()
|
|||||||
void
|
void
|
||||||
Cleanup(int excode)
|
Cleanup(int excode)
|
||||||
{
|
{
|
||||||
|
DropClient();
|
||||||
ServerClose();
|
ServerClose();
|
||||||
OsInterfaceDown(1);
|
OsInterfaceDown(1);
|
||||||
HangupModem(1);
|
HangupModem(1);
|
||||||
@ -586,7 +587,6 @@ ReadTty()
|
|||||||
int n;
|
int n;
|
||||||
char ch;
|
char ch;
|
||||||
static int ttystate;
|
static int ttystate;
|
||||||
FILE *oVarTerm;
|
|
||||||
char linebuff[LINE_LEN];
|
char linebuff[LINE_LEN];
|
||||||
|
|
||||||
LogPrintf(LogDEBUG, "termode = %d, netfd = %d, mode = %d\n",
|
LogPrintf(LogDEBUG, "termode = %d, netfd = %d, mode = %d\n",
|
||||||
@ -600,15 +600,8 @@ ReadTty()
|
|||||||
if (n)
|
if (n)
|
||||||
DecodeCommand(linebuff, n, IsInteractive(0) ? NULL : "Client");
|
DecodeCommand(linebuff, n, IsInteractive(0) ? NULL : "Client");
|
||||||
Prompt();
|
Prompt();
|
||||||
} else {
|
} else if (n < 0)
|
||||||
LogPrintf(LogPHASE, "client connection closed.\n");
|
DropClient();
|
||||||
oVarTerm = VarTerm;
|
|
||||||
VarTerm = 0;
|
|
||||||
if (oVarTerm && oVarTerm != stdout)
|
|
||||||
fclose(oVarTerm);
|
|
||||||
close(netfd);
|
|
||||||
netfd = -1;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user