Browse Source

ft: 代码修改

master
SisMaker 3 years ago
parent
commit
2f3483e746
3 changed files with 10 additions and 12 deletions
  1. +1
    -0
      .gitignore
  2. +4
    -9
      include/eWSrv.hrl
  3. +5
    -3
      src/eWSrv.erl

+ 1
- 0
.gitignore View File

@ -1,6 +1,7 @@
.eunit
*.o
*.beam
*.app
*.plt
erl_crash.dump
.concrete/DEV_MODE

+ 4
- 9
include/eWSrv.hrl View File

@ -1,3 +1,5 @@
-include_lib("eNet/include/eNet.hrl").
-define(DefWsOpts, [
binary
, {packet, 4}
@ -13,15 +15,8 @@
-export_type([wsOpt/0]).
-type wsOpt() ::
{aptCnt, non_neg_integer()} |
{tcpOpts, [gen_tcp:listen_option()]} |
{sslOpts, [ssl:ssl_option()]} |
{sslHSTet, timeout()} |
{udpOpts, [gen_udp:option()]} |
{proxyPt, boolean()} |
{proxyPtTet, timeout() |
{wsMod, module()}
}.
listenOpt() |
{wsMod, module()}.
-record(req, {
method :: elli:http_method(),

+ 5
- 3
src/eWSrv.erl View File

@ -9,16 +9,18 @@
startWSrv(WSrvName, Port, WsOpts) ->
ListenName = wsUtil:lsName(WSrvName),
TWsOpts = lists:keystore(conMod, 1, WsOpts, {conMod, wsHttp}),
LWsOpts = lists:keystore(conArgs, 1, TWsOpts, {conArgs, WSrvName}),
case ?wsGLV(sslOpts, WsOpts, false) of
false ->
{ok, _} = eNet:openTcp(ListenName, Port, WsOpts);
{ok, _} = eNet:openTcp(ListenName, Port, LWsOpts);
_ ->
{ok, _} = eNet:openSsl(ListenName, Port, WsOpts)
{ok, _} = eNet:openSsl(ListenName, Port, LWsOpts)
end,
ConSupSpec = #{
id => WSrvName,
start => {wsConSup, start_link, [ListenName]},
start => {wsConSup, start_link, [WSrvName]},
restart => permanent,
shutdown => infinity,
type => supervisor,

Loading…
Cancel
Save