00001 00002 #include "XmlRpcSource.h" 00003 #include "XmlRpcSocket.h" 00004 #include "XmlRpcUtil.h" 00005 00006 namespace XmlRpc { 00007 00008 00009 XmlRpcSource::XmlRpcSource(int fd /*= -1*/, bool deleteOnClose /*= false*/) 00010 : _fd(fd), _deleteOnClose(deleteOnClose), _keepOpen(false) 00011 { 00012 } 00013 00014 XmlRpcSource::~XmlRpcSource() 00015 { 00016 } 00017 00018 00019 void 00020 XmlRpcSource::close() 00021 { 00022 if (_fd != -1) { 00023 XmlRpcUtil::log(2,"XmlRpcSource::close: closing socket %d.", _fd); 00024 XmlRpcSocket::close(_fd); 00025 XmlRpcUtil::log(2,"XmlRpcSource::close: done closing socket %d.", _fd); 00026 _fd = -1; 00027 } 00028 if (_deleteOnClose) { 00029 XmlRpcUtil::log(2,"XmlRpcSource::close: deleting this"); 00030 _deleteOnClose = false; 00031 delete this; 00032 } 00033 } 00034 00035 } // namespace XmlRpc