Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
20
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
cellframe
cellframe-sdk
Commits
e1549971
Commit
e1549971
authored
4 years ago
by
alexander.lysikov
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug with a foreign continent in the server "auto"
parent
ead0d836
No related branches found
No related tags found
1 merge request
!90
fixed bug with a foreign continent in the server "auto"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/service/vpn/dap_chain_net_srv_vpn_cdb_server_list.c
+33
-22
33 additions, 22 deletions
modules/service/vpn/dap_chain_net_srv_vpn_cdb_server_list.c
with
33 additions
and
22 deletions
modules/service/vpn/dap_chain_net_srv_vpn_cdb_server_list.c
+
33
−
22
View file @
e1549971
...
@@ -156,7 +156,7 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg)
...
@@ -156,7 +156,7 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg)
dap_string_t
*
l_reply_str
=
dap_string_new
(
"[
\n
"
);
dap_string_t
*
l_reply_str
=
dap_string_new
(
"[
\n
"
);
char
*
l_client_ip
=
a_http_simple
->
http
->
client
->
s_ip
;
//"
77
.22
2.110.44
"
char
*
l_client_ip
=
a_http_simple
->
http
->
client
->
s_ip
;
//"
64
.22
5.61.216
"
geoip_info_t
*
l_geoip_info
=
chain_net_geoip_get_ip_info
(
l_client_ip
);
geoip_info_t
*
l_geoip_info
=
chain_net_geoip_get_ip_info
(
l_client_ip
);
log_it
(
L_DEBUG
,
"Have %zd chain networks for cdb lists"
,
s_cdb_net_count
);
log_it
(
L_DEBUG
,
"Have %zd chain networks for cdb lists"
,
s_cdb_net_count
);
...
@@ -232,28 +232,39 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg)
...
@@ -232,28 +232,39 @@ static void s_http_simple_proc(dap_http_simple_t *a_http_simple, void *a_arg)
int8_t
l_client_continent
=
l_geoip_info
?
dap_chain_net_srv_order_continent_to_num
(
l_geoip_info
->
continent
)
:
0
;
int8_t
l_client_continent
=
l_geoip_info
?
dap_chain_net_srv_order_continent_to_num
(
l_geoip_info
->
continent
)
:
0
;
// random node on client's continent
// random node on client's continent
if
(
l_client_continent
)
{
if
(
l_client_continent
>
0
&&
l_continents_numbers
[
l_client_continent
]
>
1
)
{
int
l_count
=
0
;
int
l_count
=
0
;
while
(
l_orders_num
>
0
)
{
while
(
l_orders_num
>
0
)
{
size_t
k
=
rand
()
%
l_continents_numbers
[
l_client_continent
];
size_t
k
=
rand
()
%
l_continents_numbers
[
l_client_continent
];
dap_chain_net_srv_order_t
*
l_order
=
l_orders_pos
[
k
];
size_t
l_node_pos
=
-
1
;
const
char
*
country_code
=
dap_chain_net_srv_order_get_country_code
(
l_order
);
for
(
size_t
j2
=
0
;
j2
<=
l_orders_num
;
j2
++
)
{
if
(
country_code
)
{
if
(
k
==
l_node_numbering
[
l_client_continent
][
j2
])
{
// only for other countries
l_node_pos
=
j2
;
if
(
dap_strcmp
(
l_geoip_info
->
country_code
,
country_code
)){
break
;
if
(
!
order_info_print
(
l_reply_str
,
l_net
,
l_order
,
"Auto"
,
-
1
))
{
}
dap_string_append_printf
(
l_reply_str
,
",
\n
"
);
}
break
;
if
(
l_node_pos
==
-
1
)
{
}
// random node for the whole world
}
l_node_pos
=
rand
()
%
l_orders_num
;
}
}
if
(
l_count
>
20
)
dap_chain_net_srv_order_t
*
l_order
=
l_orders_pos
[
l_node_pos
];
break
;
const
char
*
country_code
=
dap_chain_net_srv_order_get_country_code
(
l_order
);
l_count
++
;
if
(
country_code
)
{
}
// only for other countries
if
(
dap_strcmp
(
l_geoip_info
->
country_code
,
country_code
))
{
if
(
!
order_info_print
(
l_reply_str
,
l_net
,
l_order
,
"Auto"
,
-
1
))
{
dap_string_append_printf
(
l_reply_str
,
",
\n
"
);
break
;
}
}
}
if
(
l_count
>
20
)
break
;
l_count
++
;
}
}
}
// random node for the whole world
// random node for the whole world
else
{
else
{
int
l_count
=
0
;
int
l_count
=
0
;
while
(
l_orders_num
>
0
)
{
while
(
l_orders_num
>
0
)
{
...
...
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