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
ec3c76ba
Commit
ec3c76ba
authored
11 years ago
by
Eugine Blikh
Browse files
Options
Downloads
Patches
Plain Diff
1. Get port number from admin connection
2. delete setopt and delimiter contractions
parent
162f051d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/tarantool/tc.c
+24
-5
24 additions, 5 deletions
client/tarantool/tc.c
client/tarantool/tc_cli.c
+0
-1
0 additions, 1 deletion
client/tarantool/tc_cli.c
client/tarantool/tc_opt.c
+1
-2
1 addition, 2 deletions
client/tarantool/tc_opt.c
with
25 additions
and
8 deletions
client/tarantool/tc.c
+
24
−
5
View file @
ec3c76ba
...
@@ -45,9 +45,12 @@
...
@@ -45,9 +45,12 @@
#include
"client/tarantool/tc.h"
#include
"client/tarantool/tc.h"
#include
"client/tarantool/tc_cli.h"
#include
"client/tarantool/tc_cli.h"
#include
"client/tarantool/tc_print.h"
#include
"client/tarantool/tc_print.h"
#include
"client/tarantool/tc_store.h"
#include
"client/tarantool/tc_query.h"
#include
"client/tarantool/tc_print_snap.h"
#include
"client/tarantool/tc_print_snap.h"
#include
"client/tarantool/tc_print_xlog.h"
#include
"client/tarantool/tc_print_xlog.h"
#include
"client/tarantool/tc_store.h"
#define TC_DEFAULT_PORT 33013
struct
tc
tc
;
struct
tc
tc
;
...
@@ -79,6 +82,8 @@ void tc_error(char *fmt, ...) {
...
@@ -79,6 +82,8 @@ void tc_error(char *fmt, ...) {
static
void
tc_connect
(
void
)
static
void
tc_connect
(
void
)
{
{
if
(
tc
.
opt
.
port
==
0
)
tc
.
opt
.
port
=
TC_DEFAULT_PORT
;
/* allocating stream */
/* allocating stream */
tc
.
net
=
tnt_net
(
NULL
);
tc
.
net
=
tnt_net
(
NULL
);
if
(
tc
.
net
==
NULL
)
if
(
tc
.
net
==
NULL
)
...
@@ -97,10 +102,25 @@ static void tc_connect(void)
...
@@ -97,10 +102,25 @@ static void tc_connect(void)
static
void
tc_connect_admin
(
void
)
static
void
tc_connect_admin
(
void
)
{
{
if
(
tc_admin_connect
(
&
tc
.
admin
,
if
(
tc_admin_connect
(
&
tc
.
admin
,
tc
.
opt
.
host
,
tc
.
opt
.
host
,
tc
.
opt
.
port_admin
)
==
-
1
)
tc
.
opt
.
port_admin
)
==
-
1
)
tc_error
(
"admin console connection failed"
);
tc_error
(
"admin console connection failed"
);
if
(
tc
.
opt
.
port
==
0
)
{
char
*
reply
=
NULL
;
size_t
size
=
0
;
int
port
=
0
;
if
(
tc_admin_query
(
&
tc
.
admin
,
"box.cfg.primary_port"
)
==
-
1
)
tc_error
(
"cannot send query"
);
if
(
tc_admin_reply
(
&
tc
.
admin
,
&
reply
,
&
size
)
==
-
1
)
tc_error
(
"cannot recv query"
);
sscanf
(
reply
,
"---
\n
- %d
\n
..."
,
&
port
);
if
(
port
<
1024
)
tc_error
(
"cannot parse port number: %d"
,
port
);
tc
.
opt
.
port
=
port
;
free
(
reply
);
}
}
}
static
void
tc_validate
(
void
)
static
void
tc_validate
(
void
)
...
@@ -108,12 +128,11 @@ static void tc_validate(void)
...
@@ -108,12 +128,11 @@ static void tc_validate(void)
tc
.
opt
.
xlog_printer
=
tc_print_getxlogcb
(
tc
.
opt
.
format
);
tc
.
opt
.
xlog_printer
=
tc_print_getxlogcb
(
tc
.
opt
.
format
);
tc
.
opt
.
snap_printer
=
tc_print_getsnapcb
(
tc
.
opt
.
format
);
tc
.
opt
.
snap_printer
=
tc_print_getsnapcb
(
tc
.
opt
.
format
);
if
(
tc
.
opt
.
xlog_printer
==
NULL
)
if
(
tc
.
opt
.
xlog_printer
==
NULL
)
return
tc_error
(
"unsupported output xlog format '%s'"
,
tc_error
(
"unsupported output xlog format '%s'"
,
tc
.
opt
.
format
);
tc
.
opt
.
format
);
if
(
tc
.
opt
.
snap_printer
==
NULL
)
if
(
tc
.
opt
.
snap_printer
==
NULL
)
return
tc_error
(
"unsupported output snap format '%s'"
,
tc_error
(
"unsupported output snap format '%s'"
,
tc
.
opt
.
format
);
tc
.
opt
.
format
);
if
(
tc
.
opt
.
format
&&
strcmp
(
tc
.
opt
.
format
,
"raw"
)
==
0
)
if
(
tc
.
opt
.
format
&&
strcmp
(
tc
.
opt
.
format
,
"raw"
)
==
0
)
tc
.
opt
.
raw
=
1
;
tc
.
opt
.
raw
=
1
;
}
}
...
@@ -149,9 +168,9 @@ int main(int argc, char *argv[])
...
@@ -149,9 +168,9 @@ int main(int argc, char *argv[])
rc
=
tc_cli_cmdv
();
rc
=
tc_cli_cmdv
();
break
;
break
;
case
TC_OPT_INTERACTIVE
:
case
TC_OPT_INTERACTIVE
:
tc_connect
();
tc_connect_admin
();
tc_connect_admin
();
tc_cli_motd
();
tc_cli_motd
();
tc_connect
();
rc
=
tc_cli
();
rc
=
tc_cli
();
break
;
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
client/tarantool/tc_cli.c
+
0
−
1
View file @
ec3c76ba
...
@@ -109,7 +109,6 @@ static struct tnt_lex_keyword tc_lex_keywords[] =
...
@@ -109,7 +109,6 @@ static struct tnt_lex_keyword tc_lex_keywords[] =
{
"notee"
,
5
,
TC_NOTEE
},
{
"notee"
,
5
,
TC_NOTEE
},
{
"loadfile"
,
8
,
TC_LOADFILE
},
{
"loadfile"
,
8
,
TC_LOADFILE
},
{
"setopt"
,
6
,
TC_SETOPT
},
{
"setopt"
,
6
,
TC_SETOPT
},
{
"delim"
,
5
,
TC_SETOPT_DELIM
},
{
"delimiter"
,
9
,
TC_SETOPT_DELIM
},
{
"delimiter"
,
9
,
TC_SETOPT_DELIM
},
{
NULL
,
0
,
TNT_TK_NONE
}
{
NULL
,
0
,
TNT_TK_NONE
}
};
};
...
...
This diff is collapsed.
Click to expand it.
client/tarantool/tc_opt.c
+
1
−
2
View file @
ec3c76ba
...
@@ -37,7 +37,6 @@
...
@@ -37,7 +37,6 @@
#define TC_DEFAULT_HOST "localhost"
#define TC_DEFAULT_HOST "localhost"
#define TC_DEFAULT_PORT 33013
#define TC_DEFAULT_PORT_ADMIN 33015
#define TC_DEFAULT_PORT_ADMIN 33015
/* supported cli options */
/* supported cli options */
...
@@ -116,7 +115,7 @@ enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv)
...
@@ -116,7 +115,7 @@ enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv)
/* server port */
/* server port */
const
char
*
arg
=
NULL
;
const
char
*
arg
=
NULL
;
opt
->
port
=
TC_DEFAULT_PORT
;
opt
->
port
=
0
;
if
(
gopt_arg
(
tc_options
,
'p'
,
&
arg
))
if
(
gopt_arg
(
tc_options
,
'p'
,
&
arg
))
opt
->
port
=
atoi
(
arg
);
opt
->
port
=
atoi
(
arg
);
...
...
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