Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
7523e879
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7523e879
编写于
2月 06, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
2月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
!36 websocket server listening port configurable
Merge pull request !36 from JingWoo/websocket_port
上级
8a722d35
fa6a1a00
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
72 addition
and
2 deletion
+72
-2
src/cmd/isulad/arguments.c
src/cmd/isulad/arguments.c
+1
-0
src/cmd/isulad/arguments.h
src/cmd/isulad/arguments.h
+1
-0
src/cmd/isulad/commands.c
src/cmd/isulad/commands.c
+26
-0
src/cmd/isulad/commands.h
src/cmd/isulad/commands.h
+4
-1
src/config/isulad_config.c
src/config/isulad_config.c
+26
-0
src/config/isulad_config.h
src/config/isulad_config.h
+1
-0
src/constants.h
src/constants.h
+2
-0
src/json/schema/schema/isulad-daemon-configs.json
src/json/schema/schema/isulad-daemon-configs.json
+3
-0
src/websocket/service/ws_server.cc
src/websocket/service/ws_server.cc
+7
-0
src/websocket/service/ws_server.h
src/websocket/service/ws_server.h
+1
-1
未找到文件。
src/cmd/isulad/arguments.c
浏览文件 @
7523e879
...
@@ -156,6 +156,7 @@ int service_arguments_init(struct service_arguments *args)
...
@@ -156,6 +156,7 @@ int service_arguments_init(struct service_arguments *args)
args
->
default_ulimit
=
NULL
;
args
->
default_ulimit
=
NULL
;
args
->
default_ulimit_len
=
0
;
args
->
default_ulimit_len
=
0
;
args
->
json_confs
->
websocket_server_listening_port
=
DEFAULT_WEBSOCKET_SERVER_LISTENING_PORT
;
ret
=
0
;
ret
=
0
;
...
...
src/cmd/isulad/arguments.h
浏览文件 @
7523e879
...
@@ -57,6 +57,7 @@ struct service_arguments {
...
@@ -57,6 +57,7 @@ struct service_arguments {
/* default configs */
/* default configs */
host_config_ulimits_element
**
default_ulimit
;
host_config_ulimits_element
**
default_ulimit
;
size_t
default_ulimit_len
;
size_t
default_ulimit_len
;
unsigned
int
websocket_server_listening_port
;
// remaining arguments
// remaining arguments
char
*
const
*
argv
;
char
*
const
*
argv
;
...
...
src/cmd/isulad/commands.c
浏览文件 @
7523e879
...
@@ -228,6 +228,27 @@ out:
...
@@ -228,6 +228,27 @@ out:
return
ret
;
return
ret
;
}
}
static
int
check_websocket_server_listening_port
(
const
struct
service_arguments
*
args
)
{
#define MIN_REGISTER_PORT 1024
#define MAX_REGISTER_PORT 49151
int
ret
=
0
;
if
(
args
->
json_confs
->
websocket_server_listening_port
<
MIN_REGISTER_PORT
||
args
->
json_confs
->
websocket_server_listening_port
>
MAX_REGISTER_PORT
)
{
COMMAND_ERROR
(
"Invalid websocket server listening port: '%d' (range: %d-%d)"
,
args
->
json_confs
->
websocket_server_listening_port
,
MIN_REGISTER_PORT
,
MAX_REGISTER_PORT
);
ERROR
(
"Invalid websocket server listening port: '%d' (range: %d-%d)"
,
args
->
json_confs
->
websocket_server_listening_port
,
MIN_REGISTER_PORT
,
MAX_REGISTER_PORT
);
ret
=
-
1
;
goto
out
;
}
out:
return
ret
;
}
int
check_args
(
struct
service_arguments
*
args
)
int
check_args
(
struct
service_arguments
*
args
)
{
{
int
ret
=
0
;
int
ret
=
0
;
...
@@ -291,6 +312,11 @@ int check_args(struct service_arguments *args)
...
@@ -291,6 +312,11 @@ int check_args(struct service_arguments *args)
goto
out
;
goto
out
;
}
}
if
(
check_websocket_server_listening_port
(
args
)
!=
0
)
{
ret
=
-
1
;
goto
out
;
}
out:
out:
return
ret
;
return
ret
;
}
}
...
...
src/cmd/isulad/commands.h
浏览文件 @
7523e879
...
@@ -99,7 +99,10 @@ int update_default_ulimit(struct service_arguments *args);
...
@@ -99,7 +99,10 @@ int update_default_ulimit(struct service_arguments *args);
{ CMD_OPT_TYPE_STRING_DUP, false, "tlskey", 0, &(cmdargs)->json_confs->tls_config->key_file, \
{ CMD_OPT_TYPE_STRING_DUP, false, "tlskey", 0, &(cmdargs)->json_confs->tls_config->key_file, \
"Path to TLS key file (default \"/root/.iSulad/key.pem\")", NULL }, \
"Path to TLS key file (default \"/root/.iSulad/key.pem\")", NULL }, \
{ CMD_OPT_TYPE_CALLBACK, false, "default-ulimit", 0, &(cmdargs)->default_ulimit, \
{ CMD_OPT_TYPE_CALLBACK, false, "default-ulimit", 0, &(cmdargs)->default_ulimit, \
"Default ulimits for containers (default [])", command_default_ulimit_append }
"Default ulimits for containers (default [])", command_default_ulimit_append }, \
{ CMD_OPT_TYPE_CALLBACK, false, "websocket-server-listening-port", 0, \
&(cmdargs)->json_confs->websocket_server_listening_port, \
"CRI websocket streaming service listening port (default 10350)", command_convert_uint }
#endif
/* __COMMAND_H */
#endif
/* __COMMAND_H */
src/config/isulad_config.c
浏览文件 @
7523e879
...
@@ -1256,6 +1256,28 @@ out:
...
@@ -1256,6 +1256,28 @@ out:
return
plugins
;
return
plugins
;
}
}
/* conf get websocket server listening port */
int32_t
conf_get_websocket_server_listening_port
()
{
int32_t
port
=
0
;
struct
service_arguments
*
conf
=
NULL
;
if
(
isulad_server_conf_rdlock
()
!=
0
)
{
return
port
;
}
conf
=
conf_get_server_conf
();
if
(
conf
==
NULL
)
{
goto
out
;
}
port
=
conf
->
json_confs
->
websocket_server_listening_port
;
out:
(
void
)
isulad_server_conf_unlock
();
return
port
;
}
/* save args to conf */
/* save args to conf */
int
save_args_to_conf
(
struct
service_arguments
*
args
)
int
save_args_to_conf
(
struct
service_arguments
*
args
)
{
{
...
@@ -1794,6 +1816,10 @@ int merge_json_confs_into_global(struct service_arguments *args)
...
@@ -1794,6 +1816,10 @@ int merge_json_confs_into_global(struct service_arguments *args)
args
->
json_confs
->
image_layer_check
=
tmp_json_confs
->
image_layer_check
;
args
->
json_confs
->
image_layer_check
=
tmp_json_confs
->
image_layer_check
;
}
}
if
(
tmp_json_confs
->
websocket_server_listening_port
)
{
args
->
json_confs
->
websocket_server_listening_port
=
tmp_json_confs
->
websocket_server_listening_port
;
}
override_bool_pointer_value
(
&
args
->
json_confs
->
use_decrypted_key
,
&
tmp_json_confs
->
use_decrypted_key
);
override_bool_pointer_value
(
&
args
->
json_confs
->
use_decrypted_key
,
&
tmp_json_confs
->
use_decrypted_key
);
if
(
tmp_json_confs
->
insecure_skip_verify_enforce
)
{
if
(
tmp_json_confs
->
insecure_skip_verify_enforce
)
{
...
...
src/config/isulad_config.h
浏览文件 @
7523e879
...
@@ -47,6 +47,7 @@ char *conf_get_isulad_log_gather_fifo_path();
...
@@ -47,6 +47,7 @@ char *conf_get_isulad_log_gather_fifo_path();
char
*
conf_get_isulad_log_file
();
char
*
conf_get_isulad_log_file
();
char
*
conf_get_engine_log_file
();
char
*
conf_get_engine_log_file
();
char
*
conf_get_enable_plugins
();
char
*
conf_get_enable_plugins
();
int32_t
conf_get_websocket_server_listening_port
();
int
save_args_to_conf
(
struct
service_arguments
*
args
);
int
save_args_to_conf
(
struct
service_arguments
*
args
);
...
...
src/constants.h
浏览文件 @
7523e879
...
@@ -59,5 +59,7 @@
...
@@ -59,5 +59,7 @@
#define MAX_MSG_BUFFER_SIZE (32 * 1024)
#define MAX_MSG_BUFFER_SIZE (32 * 1024)
#define DEFAULT_WEBSOCKET_SERVER_LISTENING_PORT 10350
#endif
#endif
src/json/schema/schema/isulad-daemon-configs.json
浏览文件 @
7523e879
...
@@ -118,6 +118,9 @@
...
@@ -118,6 +118,9 @@
"cgroup-parent"
:
{
"cgroup-parent"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"websocket-server-listening-port"
:
{
"type"
:
"int32"
},
"default-ulimits"
:
{
"default-ulimits"
:
{
"type"
:
"object"
,
"type"
:
"object"
,
"patternProperties"
:
{
"patternProperties"
:
{
...
...
src/websocket/service/ws_server.cc
浏览文件 @
7523e879
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "utils.h"
#include "utils.h"
#include "request_cache.h"
#include "request_cache.h"
#include "constants.h"
#include "constants.h"
#include "isulad_config.h"
struct
lws_context
*
WebsocketServer
::
m_context
=
nullptr
;
struct
lws_context
*
WebsocketServer
::
m_context
=
nullptr
;
std
::
atomic
<
WebsocketServer
*>
WebsocketServer
::
m_instance
;
std
::
atomic
<
WebsocketServer
*>
WebsocketServer
::
m_instance
;
...
@@ -385,6 +386,12 @@ void WebsocketServer::ServiceWorkThread(int threadid)
...
@@ -385,6 +386,12 @@ void WebsocketServer::ServiceWorkThread(int threadid)
void
WebsocketServer
::
Start
(
Errors
&
err
)
void
WebsocketServer
::
Start
(
Errors
&
err
)
{
{
m_listenPort
=
conf_get_websocket_server_listening_port
();
if
(
m_listenPort
==
0
)
{
err
.
SetError
(
"Failed to get websocket server listening port from daemon config"
);
return
;
}
if
(
CreateContext
()
<
0
)
{
if
(
CreateContext
()
<
0
)
{
err
.
SetError
(
"Websocket server start failed!, please check your network status"
err
.
SetError
(
"Websocket server start failed!, please check your network status"
"(eg: port "
+
std
::
to_string
(
m_listenPort
)
+
"is occupied)"
);
"(eg: port "
+
std
::
to_string
(
m_listenPort
)
+
"is occupied)"
);
...
...
src/websocket/service/ws_server.h
浏览文件 @
7523e879
...
@@ -116,7 +116,7 @@ private:
...
@@ -116,7 +116,7 @@ private:
RouteCallbackRegister
m_handler
;
RouteCallbackRegister
m_handler
;
static
std
::
map
<
struct
lws
*
,
session_data
>
m_wsis
;
static
std
::
map
<
struct
lws
*
,
session_data
>
m_wsis
;
url
::
URLDatum
m_url
;
url
::
URLDatum
m_url
;
int
m_listenPort
=
10251
;
int
m_listenPort
;
};
};
ssize_t
WsWriteToClient
(
void
*
context
,
const
void
*
data
,
size_t
len
);
ssize_t
WsWriteToClient
(
void
*
context
,
const
void
*
data
,
size_t
len
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录