Permalink
Browse files

SchedStatus is not an integer.

SchedStatus rc is an enum, assigning negative integer values
to it does not do what we want.  Use an int to store int return
values.
(cherry picked from commit a6893db)
  • Loading branch information...
1 parent be3e1ab commit 3c199e5695dbbf80aa38812f8cf0843db3496357 @ssinger ssinger committed Jan 20, 2011
Showing with 12 additions and 7 deletions.
  1. +3 −0 RELEASE
  2. +9 −7 src/slon/remote_listen.c
View
@@ -314,4 +314,7 @@ RELEASE 2.0.6
-Fix for bug #154, previous fix did not work
+2.0.7
+-Fix for bug where slon was not properly detecting connection failures when
+ receiving events from the remote listener.
View
@@ -77,6 +77,7 @@ remoteListenThread_main(void *cdata)
char *conn_conninfo = NULL;
char conn_symname[64];
ScheduleStatus rc;
+ int retVal;
SlonDString query1;
PGconn *dbconn = NULL;
PGresult *res;
@@ -252,13 +253,13 @@ remoteListenThread_main(void *cdata)
continue;
}
PQclear(res);
- rc = db_getLocalNodeId(dbconn);
- if (rc != node->no_id)
+ retVal = db_getLocalNodeId(dbconn);
+ if (retVal != node->no_id)
{
slon_log(SLON_ERROR,
"remoteListenThread_%d: db_getLocalNodeId() "
"returned %d - wrong database?\n",
- node->no_id, rc);
+ node->no_id, retVal);
slon_disconnectdb(conn);
free(conn_conninfo);
@@ -298,8 +299,8 @@ remoteListenThread_main(void *cdata)
/*
* Receive events from the provider node
*/
- rc = remoteListen_receive_events(node, conn, listat_head);
- if (rc < 0)
+ retVal = remoteListen_receive_events(node, conn, listat_head);
+ if (retVal < 0)
{
slon_disconnectdb(conn);
free(conn_conninfo);
@@ -319,8 +320,8 @@ remoteListenThread_main(void *cdata)
* database.
*/
- rc = remoteListen_forward_confirm(node, conn);
- if (rc < 0)
+ retVal = remoteListen_forward_confirm(node, conn);
+ if (retVal < 0)
{
slon_disconnectdb(conn);
free(conn_conninfo);
@@ -336,6 +337,7 @@ remoteListenThread_main(void *cdata)
/*
* Wait for notification.
*/
+
rc = sched_wait_time(conn, SCHED_WAIT_SOCK_READ, poll_sleep);
if (rc == SCHED_STATUS_CANCEL)
continue;

0 comments on commit 3c199e5

Please sign in to comment.