summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/mci.c
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2005-02-14 03:04:18 +0000
committergshapiro <gshapiro@FreeBSD.org>2005-02-14 03:04:18 +0000
commit476228659f3f241ba8be1db8703b14c5f443082a (patch)
tree0d1e1e48f37b259b3d84394eb3ccc2ba9f5ee2cc /contrib/sendmail/src/mci.c
parent8c041fae951361fde075b332cfc14251e7463a5f (diff)
downloadFreeBSD-src-476228659f3f241ba8be1db8703b14c5f443082a.zip
FreeBSD-src-476228659f3f241ba8be1db8703b14c5f443082a.tar.gz
Commit patch from sendmail.org web site for socket close bug:
http://www.sendmail.org/patches/close_wait.p2 This is being put in the vendor branch as it is in the vendor's repo.
Diffstat (limited to 'contrib/sendmail/src/mci.c')
-rw-r--r--contrib/sendmail/src/mci.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index 4955197..4ff7578 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -398,6 +398,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
**
OpenPOWER on IntegriCloud