diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-04-03 01:41:19 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2014-04-03 01:42:35 +0100 |
commit | e7fc7f31b9c1c405b57c83b46475eb8618a66362 (patch) | |
tree | c16a2c048302d4af51670edaec59a47b239cd890 /psycopg/connection_int.c | |
parent | 0258e90ef069161de5f6b2d02fa26f031d9674fc (diff) | |
download | psycopg2-e7fc7f31b9c1c405b57c83b46475eb8618a66362.tar.gz |
Fixed dsn and closed attributes in failing connection subclasses.
From ticket #192 discussion.
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r-- | psycopg/connection_int.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index c48dc81..aea2841 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -629,14 +629,23 @@ _conn_async_connect(connectionObject *self) int conn_connect(connectionObject *self, long int async) { - if (async == 1) { + int rv; + + if (async == 1) { Dprintf("con_connect: connecting in ASYNC mode"); - return _conn_async_connect(self); + rv = _conn_async_connect(self); } else { Dprintf("con_connect: connecting in SYNC mode"); - return _conn_sync_connect(self); + rv = _conn_sync_connect(self); + } + + if (rv != 0) { + /* connection failed, so let's close ourselves */ + self->closed = 2; } + + return rv; } |