Merge mci.c change to add mci_close() from the vendor branch.

Problem noted by:	marcus
This commit is contained in:
Gregory Neil Shapiro 2005-02-14 08:04:08 +00:00
parent 9945c0e21f
commit dbda3744f4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=141887

View File

@ -399,6 +399,57 @@ mci_get(host, m)
return mci;
}
/*
** MCI_CLOSE -- (forcefully) close files used for a connection.
** Note: this is a last resort, usually smtpquit() or endmailer()
** should be used to close a connection.
**
** Parameters:
** mci -- the connection to close.
** where -- where has this been called?
**
** Returns:
** none.
*/
void
mci_close(mci, where)
MCI *mci;
char *where;
{
bool dumped;
if (mci == NULL)
return;
dumped = false;
if (mci->mci_out != NULL)
{
if (tTd(56, 1))
{
sm_dprintf("mci_close: mci_out!=NULL, where=%s\n",
where);
mci_dump(sm_debug_file(), mci, false);
dumped = true;
}
(void) sm_io_close(mci->mci_out, SM_TIME_DEFAULT);
mci->mci_out = NULL;
}
if (mci->mci_in != NULL)
{
if (tTd(56, 1))
{
sm_dprintf("mci_close: mci_in!=NULL, where=%s\n",
where);
if (!dumped)
mci_dump(sm_debug_file(), mci, false);
}
(void) sm_io_close(mci->mci_in, SM_TIME_DEFAULT);
mci->mci_in = NULL;
}
mci->mci_state = MCIS_CLOSED;
}
/*
** MCI_NEW -- allocate new MCI structure
**