Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57f620d

Browse files
committed
Copy dtmhost string on call to TuneToDtm.
1 parentda45ca5 commit57f620d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

‎contrib/pg_dtm/libdtm.c‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,15 @@ static bool dtm_query(DTMConn dtm, char cmd, int argc, ...)
231231
return true;
232232
}
233233

234-
staticchar*dtmhost="127.0.0.1";
235-
staticintdtmport=5431;
234+
staticchar*dtmhost=NULL;
235+
staticintdtmport=0;
236236

237237
voidTuneToDtm(char*host,intport) {
238-
dtmhost=host;
238+
if (dtmhost) {
239+
free(dtmhost);
240+
dtmhost=NULL;
241+
}
242+
dtmhost=strdup(host);
239243
dtmport=port;
240244
}
241245

@@ -244,10 +248,15 @@ static DTMConn GetConnection()
244248
staticDTMConndtm=NULL;
245249
if (dtm==NULL)
246250
{
247-
dtm=DtmConnect(dtmhost,dtmport);
248-
if (dtm==NULL) {
249-
elog(ERROR,"Failed to connect to DTMD");
250-
}
251+
if (dtmhost) {
252+
dtm=DtmConnect(dtmhost,dtmport);
253+
if (dtm==NULL)
254+
{
255+
elog(ERROR,"Failed to connect to DTMD %s:%d",dtmhost,dtmport);
256+
}
257+
}else {
258+
elog(ERROR,"DTMD address not specified");
259+
}
251260
}
252261
returndtm;
253262
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp