cvs: pear /Net_SMTP SMTP.php package.xml
| From: | Jon Parise | Date: | Fri, 10 Jan 2003 21:17:05 +0000 |
| Subject: | cvs: pear /Net_SMTP SMTP.php package.xml | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8182@lists.php.net to get a copy of this message | ||
jon Fri Jan 10 16:17:05 2003 EDT
Modified files:
/pear/Net_SMTP SMTP.php package.xml
Log:
A timeout value can now be specified for the socket connection via an
argument to the connect() method.
Also, all socket-related failures now include the string component of the
Net_Socket PEAR_Error object.
Index: pear/Net_SMTP/SMTP.php
diff -u pear/Net_SMTP/SMTP.php:1.18 pear/Net_SMTP/SMTP.php:1.19
--- pear/Net_SMTP/SMTP.php:1.18 Fri Jan 10 16:03:27 2003
+++ pear/Net_SMTP/SMTP.php Fri Jan 10 16:17:05 2003
@@ -243,14 +243,20 @@
/**
* Attempt to connect to the SMTP server.
*
+ * @param int $timeout The timeout value (in seconds) for the
+ * socket connection.
+ *
* @return mixed Returns a PEAR_Error with an error message on any
* kind of failure, or true on success.
* @access public
*/
- function connect()
+ function connect($timeout = null)
{
- if (PEAR::isError($this->_socket->connect($this->host, $this->port))) {
- return new PEAR_Error('unable to open socket');
+ $result = $this->_socket->connect($this->host, $this->port,
+ false, $timeout);
+ if (PEAR::isError($result)) {
+ return new PEAR_Error('Failed to connect socket: ' .
+ $result->getMessage());
}
if (PEAR::isError($error = $this->_parseResponse(220))) {
@@ -278,8 +284,9 @@
if (PEAR::isError($error = $this->_parseResponse(221))) {
return $error;
}
- if (PEAR::isError($this->_socket->disconnect())) {
- return new PEAR_Error('socket disconnect failed');
+ if (PEAR::isError($error = $this->_socket->disconnect())) {
+ return new PEAR_Error('Failed to disconnect socket: ' .
+ $error->getMessage());
}
return true;
Index: pear/Net_SMTP/package.xml
diff -u pear/Net_SMTP/package.xml:1.9 pear/Net_SMTP/package.xml:1.10
--- pear/Net_SMTP/package.xml:1.9 Fri Jan 10 15:28:09 2003
+++ pear/Net_SMTP/package.xml Fri Jan 10 16:17:05 2003
@@ -30,6 +30,7 @@
- Improved support for SMTP authentication (LOGIN, PLAIN).
- Overhauled the server response parsing system.
- Added optional debugging output (enabled via setDebug()).
+- A timeout value can now be specified for the socket connection.
</notes>
<state>stable</state>
<filelist>