Skip to content

Commit

Permalink
Make the code compile against pre-9.2 servers again.
Browse files Browse the repository at this point in the history
  • Loading branch information
hlinnaka committed Apr 20, 2012
1 parent 9bdc5cf commit 4062b53
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dbgcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "miscadmin.h"
#include "storage/backendid.h"
#include "storage/lwlock.h"
#include "storage/shmem.h"
#include "storage/sinvaladt.h"

Expand Down Expand Up @@ -58,6 +59,7 @@
typedef struct
{
int status;
int pid;
int port;
} dbgcomm_target_slot_t;

Expand Down Expand Up @@ -136,7 +138,6 @@ dbgcomm_connect_to_proxy(int proxyPort)
struct sockaddr_in localaddr = {0};
socklen_t addrlen = sizeof( remoteaddr );
int reuse_addr_flag = 1;
int remoteport;

dbgcomm_init();

Expand Down Expand Up @@ -177,6 +178,7 @@ dbgcomm_connect_to_proxy(int proxyPort)
/* XXX: locking */
dbgcomm_slots[MyBackendId].port = ntohs(localaddr.sin_port);
dbgcomm_slots[MyBackendId].status = DBGCOMM_CONNECTING_TO_PROXY;
dbgcomm_slots[MyBackendId].pid = MyProcPid;

remoteaddr.sin_family = AF_INET;
remoteaddr.sin_port = htons(proxyPort);
Expand All @@ -188,7 +190,7 @@ dbgcomm_connect_to_proxy(int proxyPort)
{
ereport(COMMERROR,
(errcode_for_socket_access(),
errmsg("could not connect to debugging proxy at port %d: %m", remoteport)));
errmsg("could not connect to debugging proxy at port %d: %m", proxyPort)));
/*
* Reset our entry in the array. On success, this will be done by
* the proxy.
Expand Down Expand Up @@ -256,6 +258,7 @@ dbgcomm_listen_for_proxy(void)
/* XXX: locking */
dbgcomm_slots[MyBackendId].port = localport;
dbgcomm_slots[MyBackendId].status = DBGCOMM_LISTENING_FOR_PROXY;
dbgcomm_slots[MyBackendId].pid = MyProcPid;

/* Notify the client application that this backend is waiting for a proxy. */
elog(NOTICE, "PLDBGBREAK:%d", MyBackendId);
Expand Down Expand Up @@ -408,8 +411,8 @@ dbgcomm_accept_target(int sockfd, int *targetPid)
if (dbgcomm_slots[i].status == DBGCOMM_CONNECTING_TO_PROXY &&
dbgcomm_slots[i].port == ntohs(remoteaddr.sin_port))
{
*targetPid = dbgcomm_slots[i].pid;
dbgcomm_slots[i].status = DBGCOMM_IDLE;
*targetPid = BackendIdGetProc(i)->pid;
break;
}
}
Expand Down

0 comments on commit 4062b53

Please sign in to comment.