From a3e566c4d3631076e29f3651554603184b6351a7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 17 May 2009 01:34:10 +0200 Subject: Gnulib durch boost ersetzt --- src/Net/ClientConnection.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/Net/ClientConnection.cpp') diff --git a/src/Net/ClientConnection.cpp b/src/Net/ClientConnection.cpp index e4de735..688dbc7 100644 --- a/src/Net/ClientConnection.cpp +++ b/src/Net/ClientConnection.cpp @@ -21,6 +21,8 @@ #include "FdManager.h" #include "IPAddress.h" +#include + #include #include #include @@ -56,19 +58,17 @@ void ClientConnection::connectionHeader() { } void ClientConnection::connect(const IPAddress &address, bool daemon0) throw(Exception) { - gl_rwlock_wrlock(stateLock); + boost::unique_lock lock(stateLock); daemon = daemon0; if(_isConnected()) { - gl_rwlock_unlock(stateLock); return; // TODO Error } sock = socket(PF_INET, SOCK_STREAM, 0); if(sock < 0) { - gl_rwlock_unlock(stateLock); throw Exception("socket()", Exception::INTERNAL_ERRNO, errno); } @@ -81,7 +81,6 @@ void ClientConnection::connect(const IPAddress &address, bool daemon0) throw(Exc delete peer; peer = 0; - gl_rwlock_unlock(stateLock); throw Exception("connect()", Exception::INTERNAL_ERRNO, errno); } @@ -91,7 +90,6 @@ void ClientConnection::connect(const IPAddress &address, bool daemon0) throw(Exc if(flags < 0) { close(sock); - gl_rwlock_unlock(stateLock); throw Exception("fcntl()", Exception::INTERNAL_ERRNO, errno); } @@ -110,7 +108,7 @@ void ClientConnection::connect(const IPAddress &address, bool daemon0) throw(Exc state = CONNECT; - gl_rwlock_unlock(stateLock); + lock.unlock(); updateEvents(); } -- cgit v1.2.3