Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
00ba6cbc
Commit
00ba6cbc
authored
11 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/tt-port-master'
Conflicts: client/tarantool/tc.c
parents
c3023451
0bcb77a2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/tarantool/tc.c
+22
-6
22 additions, 6 deletions
client/tarantool/tc.c
with
22 additions
and
6 deletions
client/tarantool/tc.c
+
22
−
6
View file @
00ba6cbc
...
@@ -51,6 +51,8 @@
...
@@ -51,6 +51,8 @@
#include
"client/tarantool/tc_print_xlog.h"
#include
"client/tarantool/tc_print_xlog.h"
#define TC_DEFAULT_PORT 33013
#define TC_DEFAULT_PORT 33013
#define TC_DEFAULT_PORT 33013
#define TC_ERR_CMD "---\nunknown command. try typing help.\n...\n"
struct
tc
tc
;
struct
tc
tc
;
...
@@ -100,17 +102,31 @@ static void tc_connect(void)
...
@@ -100,17 +102,31 @@ static void tc_connect(void)
tc_error
(
"%s"
,
tnt_strerror
(
tc
.
net
));
tc_error
(
"%s"
,
tnt_strerror
(
tc
.
net
));
}
}
static
int
get_primary_port
(
voi
d
)
static
char
*
send_cmd
(
char
*
cm
d
)
{
{
char
*
reply
=
NULL
;
size_t
size
=
0
;
size_t
size
=
0
;
int
port
=
0
;
char
*
reply
=
NULL
;
if
(
tc_admin_query
(
&
tc
.
admin
,
"lua box.cfg.primary_port"
)
==
-
1
)
if
(
tc_admin_query
(
&
tc
.
admin
,
cmd
)
==
-
1
)
tc_error
(
"cannot send query"
);
tc_error
(
"cannot send query"
);
if
(
tc_admin_reply
(
&
tc
.
admin
,
&
reply
,
&
size
)
==
-
1
)
if
(
tc_admin_reply
(
&
tc
.
admin
,
&
reply
,
&
size
)
==
-
1
)
tc_error
(
"cannot recv query"
);
tc_error
(
"cannot recv query"
);
sscanf
(
reply
,
"---
\n
- %d
\n
..."
,
&
port
);
if
(
strncmp
(
reply
,
TC_ERR_CMD
,
size
)
==
0
)
{
free
(
reply
);
free
(
reply
);
return
NULL
;
}
return
reply
;
}
static
int
get_primary_port
()
{
int
port
=
0
;
char
*
reply
=
send_cmd
(
"box.cfg.primary_port"
);
if
(
reply
==
NULL
)
reply
=
send_cmd
(
"lua box.cfg.primary_port"
);
if
(
reply
!=
NULL
)
{
sscanf
(
reply
,
"---
\n
- %d
\n
..."
,
&
port
);
free
(
reply
);
}
return
port
;
return
port
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment