00001 00007 #include "XmlRpcSource.h" 00008 #include "XmlRpcSocket.h" 00009 #include "XmlRpcUtil.h" 00010 00011 namespace XmlRpc { 00012 00013 00014 XmlRpcSource::XmlRpcSource(int fd /*= -1*/, bool deleteOnClose /*= false*/) 00015 : _fd(fd), _deleteOnClose(deleteOnClose), _keepOpen(false) 00016 { 00017 } 00018 00019 XmlRpcSource::~XmlRpcSource() 00020 { 00021 } 00022 00023 00024 void 00025 XmlRpcSource::close() 00026 { 00027 if (_fd != -1) { 00028 XmlRpcUtil::log(2,"XmlRpcSource::close: closing socket %d.", _fd); 00029 XmlRpcSocket::close(_fd); 00030 XmlRpcUtil::log(2,"XmlRpcSource::close: done closing socket %d.", _fd); 00031 _fd = -1; 00032 } 00033 if (_deleteOnClose) { 00034 XmlRpcUtil::log(2,"XmlRpcSource::close: deleting this"); 00035 _deleteOnClose = false; 00036 delete this; 00037 } 00038 #ifdef USE_SSL 00039 if (_ssl_ssl != (SSL *) NULL) { 00040 SSL_shutdown (_ssl_ssl); 00041 SSL_free (_ssl_ssl); 00042 SSL_CTX_free (_ssl_ctx); 00043 } 00044 #endif 00045 } 00046 00047 } // namespace XmlRpc