diff options
-rw-r--r-- | contrib/sendmail/src/mci.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c index 894c302..095700b 100644 --- a/contrib/sendmail/src/mci.c +++ b/contrib/sendmail/src/mci.c @@ -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 ** |