]> git.tdb.fi Git - libs/net.git/blobdiff - source/streamsocket.cpp
Don't consider calling poll_connect without a connection attempt an error
[libs/net.git] / source / streamsocket.cpp
index b06cf69ca9314cb6c750c1147513f9b4dc9c3a0a..ed506d6320881c4a4169b54d836da483538510ec 100644 (file)
@@ -82,16 +82,10 @@ bool StreamSocket::connect(const SockAddr &addr)
 bool StreamSocket::poll_connect(const Time::TimeDelta &timeout)
 {
        if(!connecting)
-               throw bad_socket_state("not connecting");
+               return false;
 
-       int res = poll(*this, IO::P_OUTPUT, timeout);
-       if(res==-1)
-#ifdef WIN32
-               throw system_error("poll", WSAGetLastError());
-#else
-               throw system_error("poll");
-#endif
-       else if(res>0)
+       IO::PollEvent res = poll(*this, IO::P_OUTPUT, timeout);
+       if(res&IO::P_OUTPUT)
        {
                connecting = false;