{
public:
UnixListener(const DOMElement* e);
- ~UnixListener() {}
+ ~UnixListener() {if (m_bound) unlink(m_address.c_str());}
bool create(ShibSocket& s) const;
bool bind(ShibSocket& s, bool force=false) const;
bool log_error() const;
string m_address;
+ bool m_bound;
Category& m_log;
};
return new UnixListener(e);
}
-UnixListener::UnixListener(const DOMElement* e) : m_address("/tmp/shar-socket"),
+UnixListener::UnixListener(const DOMElement* e) : m_address("/tmp/shar-socket"), m_bound(false),
m_log(Category::getInstance("shibtarget.UnixListener"))
{
// We're stateless, but we need to load the configuration.
}
listen(s, 3);
- return true;
+ return m_bound=true;
}
bool UnixListener::connect(ShibSocket& s) const
bool UnixListener::close(ShibSocket& s) const
{
- if (!m_address.empty()) {
- if (unlink(m_address.c_str()))
- log_error();
- }
::close(s);
return true;
}