Add some check if we are still connected.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40831 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2011-03-06 07:42:20 +00:00
parent faad334022
commit 8c018efae7

View File

@ -158,6 +158,9 @@ SocketConnection::SocketConnection()
status_t status_t
SocketConnection::Connect(const char* server, uint32 port) SocketConnection::Connect(const char* server, uint32 port)
{ {
if (fSocket >= 0)
Disconnect();
TRACE("SocketConnection to server %s:%i\n", server, (int)port); TRACE("SocketConnection to server %s:%i\n", server, (int)port);
uint32 hostIP = inet_addr(server); uint32 hostIP = inet_addr(server);
// first see if we can parse it as a numeric address // first see if we can parse it as a numeric address
@ -249,6 +252,9 @@ SSLConnection::SSLConnection()
status_t status_t
SSLConnection::Connect(const char* server, uint32 port) SSLConnection::Connect(const char* server, uint32 port)
{ {
if (fSSL != NULL)
Disconnect();
BAutolock _(fLocker); BAutolock _(fLocker);
status_t status = SocketConnection::Connect(server, port); status_t status = SocketConnection::Connect(server, port);