summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2011-07-08 13:24:34 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-07-18 18:15:40 +0200
commit082431ba8dbdbf990a146e7109876d6318f0f7b9 (patch)
treeaec5c2128b024ced4d766d1ef50e56a30883514b /client
parent492f7a9b84c60e3638c182cb7d0c5b62effbe1bd (diff)
downloadspice-082431ba8dbdbf990a146e7109876d6318f0f7b9.tar.gz
spice-082431ba8dbdbf990a146e7109876d6318f0f7b9.tar.xz
spice-082431ba8dbdbf990a146e7109876d6318f0f7b9.zip
client: rename connect_unsecure to connect_to_peer
Both connect_secure() and connect_unsecure() call connect_to_peer(). Prior to this commit spicec.log reported all connections as unsecure, as connect_secure() called connect_unsecure() to make the connection. This fixes RH bug #653545
Diffstat (limited to 'client')
-rw-r--r--client/red_peer.cpp18
-rw-r--r--client/red_peer.h1
2 files changed, 15 insertions, 4 deletions
diff --git a/client/red_peer.cpp b/client/red_peer.cpp
index de0817d5..17fcb456 100644
--- a/client/red_peer.cpp
+++ b/client/red_peer.cpp
@@ -68,7 +68,7 @@ void RedPeer::cleanup()
}
}
-void RedPeer::connect_unsecure(const char* host, int portnr)
+void RedPeer::connect_to_peer(const char* host, int portnr)
{
struct addrinfo ai, *result = NULL, *e;
char uaddr[INET6_ADDRSTRLEN+1];
@@ -104,7 +104,8 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
getnameinfo((struct sockaddr*)e->ai_addr, e->ai_addrlen,
uaddr,INET6_ADDRSTRLEN, uport,32,
NI_NUMERICHOST | NI_NUMERICSERV);
- LOG_INFO("Trying %s %s", uaddr, uport);
+ DBG(0, "Trying %s %s", uaddr, uport);
+
if (::connect(_peer, e->ai_addr, e->ai_addrlen) == SOCKET_ERROR) {
err = sock_error();
LOG_INFO("Connect failed: %s (%d)",
@@ -113,7 +114,7 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
_peer = INVALID_SOCKET;
continue;
}
- LOG_INFO("Connected to %s %s", uaddr, uport);
+ DBG(0, "Connected to %s %s", uaddr, uport);
break;
}
lock.unlock();
@@ -130,14 +131,23 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
}
}
+void RedPeer::connect_unsecure(const char* host, int portnr)
+{
+ connect_to_peer(host, portnr);
+ ASSERT(_ctx == NULL && _ssl == NULL && _peer != INVALID_SOCKET);
+ LOG_INFO("Connected to %s %d", host, portnr);
+}
+
void RedPeer::connect_secure(const ConnectionOptions& options, const char* host)
{
int return_code;
SPICE_SSL_VERIFY_OP auth_flags;
SpiceOpenSSLVerify* verify = NULL;
+ int portnr = options.secure_port;
- connect_unsecure(host, options.secure_port);
+ connect_to_peer(host, portnr);
ASSERT(_ctx == NULL && _ssl == NULL && _peer != INVALID_SOCKET);
+ LOG_INFO("Connected to %s %d", host, portnr);
try {
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
diff --git a/client/red_peer.h b/client/red_peer.h
index 0279f0d3..89323570 100644
--- a/client/red_peer.h
+++ b/client/red_peer.h
@@ -123,6 +123,7 @@ protected:
void cleanup();
private:
+ void connect_to_peer(const char* host, int port);
void shutdown();
private: