| 111 | } |
| 112 | |
| 113 | bool smtp_client::open(void) |
| 114 | { |
| 115 | if (stream_.opened()) { |
| 116 | acl_assert(client_ != NULL); |
| 117 | acl_assert(client_->conn == stream_.get_vstream()); |
| 118 | reuse_ = true; |
| 119 | return true; |
| 120 | } |
| 121 | |
| 122 | reuse_ = false; |
| 123 | |
| 124 | client_ = smtp_open(addr_, conn_timeout_, rw_timeout_, 1024); |
| 125 | if (client_ == NULL) { |
| 126 | logger_error("connect %s error: %s", addr_, last_serror()); |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | // ��������ֻ����ʹ�� stream_ ��ҪΪ��ʹ�� SSL ͨ�� |
| 131 | stream_.open(client_->conn); |
| 132 | |
| 133 | // ��������� SSL ͨ�ŷ�ʽ������Ҫ�� SSL ͨ�Žӿ� |
| 134 | if (ssl_conf_) { |
| 135 | sslbase_io* ssl = ssl_conf_->create(false); |
| 136 | if (stream_.setup_hook(ssl) == ssl) { |
| 137 | logger_error("open ssl client error!"); |
| 138 | ssl->destroy(); |
| 139 | return false; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | return true; |
| 144 | } |
| 145 | |
| 146 | void smtp_client::close(void) |
| 147 | { |
nothing calls this directly
no test coverage detected