forked from x/icebergs
opt some
This commit is contained in:
parent
74b1019a1d
commit
59159a897a
@ -29,11 +29,7 @@ func _runtime_init(m *ice.Message) {
|
||||
m.Conf(RUNTIME, kit.Keys(HOST, HOME), kit.HomePath(""))
|
||||
m.Conf(RUNTIME, kit.Keys(HOST, MAXPROCS), runtime.GOMAXPROCS(0))
|
||||
ice.Info.System = m.Conf(RUNTIME, kit.Keys(HOST, OSID))
|
||||
ice.Info.PidPath = ice.VAR_LOG_ICE_PID
|
||||
kit.For(ENV_LIST, func(k string) {
|
||||
m.Conf(RUNTIME, kit.Keys(CONF, k), kit.Env(k))
|
||||
kit.If(k == CTX_PID, func() { ice.Info.PidPath = kit.Env(k) })
|
||||
})
|
||||
kit.For(ENV_LIST, func(k string) { m.Conf(RUNTIME, kit.Keys(CONF, k), kit.Env(k)) })
|
||||
ice.Info.Lang = m.Conf(RUNTIME, kit.Keys(CONF, LANG))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, USERNAME), kit.UserName())
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME), kit.Env("HOSTNAME"))
|
||||
|
@ -19,13 +19,11 @@ func (f *Frame) Begin(m *ice.Message, arg ...string) {
|
||||
f.s = make(chan os.Signal, 10)
|
||||
}
|
||||
func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
kit.If(ice.Info.PidPath, func(p string) {
|
||||
if f, p, e := logs.CreateFile(p); e == nil {
|
||||
defer f.Close()
|
||||
m.Logs("save", "file", p, PID, os.Getpid())
|
||||
fmt.Fprint(f, os.Getpid())
|
||||
}
|
||||
})
|
||||
if f, p, e := logs.CreateFile(ice.VAR_LOG_ICE_PID); e == nil {
|
||||
m.Logs("save", "file", p, PID, os.Getpid())
|
||||
fmt.Fprint(f, os.Getpid())
|
||||
f.Close()
|
||||
}
|
||||
t := time.NewTicker(kit.Duration(mdb.Conf(m, TIMER, kit.Keym(TICK))))
|
||||
for {
|
||||
select {
|
||||
@ -41,7 +39,6 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (f *Frame) Close(m *ice.Message, arg ...string) {
|
||||
close(f.s)
|
||||
kit.If(ice.Info.PidPath, func(p string) { os.Remove(p) })
|
||||
}
|
||||
func (f *Frame) listen(m *ice.Message, s int, arg ...string) {
|
||||
signal.Notify(f.s, syscall.Signal(s))
|
||||
|
@ -20,7 +20,7 @@ func _signal_action(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m.Spawn(), arg...).Table(func(value ice.Maps) { m.Cmdy(kit.Split(value[ice.CMD])) })
|
||||
}
|
||||
func _signal_process(m *ice.Message, p string, s os.Signal) {
|
||||
kit.If(p == "", func() { b, _ := file.ReadFile(ice.Info.PidPath); p = string(b) })
|
||||
kit.If(p == "", func() { b, _ := file.ReadFile(ice.VAR_LOG_ICE_PID); p = string(b) })
|
||||
if p, e := os.FindProcess(kit.Int(kit.Select(kit.Format(os.Getpid()), p))); e == nil {
|
||||
p.Signal(s)
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ func _dream_start(m *ice.Message, name string) {
|
||||
}
|
||||
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
||||
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.EnvList(kit.Simple(m.OptionSimple(ice.TCP_DOMAIN),
|
||||
cli.CTX_OPS, HostPort(m, tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG, cli.CTX_PID, ice.VAR_LOG_ICE_PID,
|
||||
cli.CTX_OPS, HostPort(m, tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG,
|
||||
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
||||
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
||||
kit.If(m.Option(nfs.BINARY) == "" && !cli.SystemFindGo(m), func(p string) { m.Option(nfs.BINARY, S(name)) })
|
||||
|
@ -252,6 +252,14 @@ func init() {
|
||||
m.Cmd(cli.SYSTEM, "sudo", PROXY_CMDS, "-s", "reload", kit.Dict(cli.CMD_DIR, dir))
|
||||
}
|
||||
}
|
||||
if m.Cmd(tcp.HOST).Length() == 0 {
|
||||
return
|
||||
}
|
||||
m.Cmds(SPIDE).Table(func(value ice.Maps) {
|
||||
kit.If(value[TOKEN], func() {
|
||||
m.Cmd(SPACE, tcp.DIAL, ice.DEV, value[CLIENT_NAME], TOKEN, value[TOKEN], mdb.TYPE, SERVER)
|
||||
})
|
||||
})
|
||||
}},
|
||||
PROXY_CONF: {Name: "proxyConf name* port host path", Hand: func(m *ice.Message, arg ...string) {
|
||||
if dir := m.OptionDefault(nfs.PATH, PROXY_PATH, tcp.HOST, "127.0.0.1", tcp.PORT, "9020"); nfs.Exists(m, dir) {
|
||||
|
@ -194,6 +194,7 @@ func _space_exec(m *ice.Message, name string, source, target []string, c *websoc
|
||||
return
|
||||
}
|
||||
m.OptionDefault(ice.MSG_COUNT, "0")
|
||||
m.Option(ice.MSG_ARGS, "")
|
||||
kit.If(m.Option(ice.MSG_DAEMON), func(p string) {
|
||||
m.Option(ice.MSG_DAEMON0, m.Option(ice.MSG_DAEMON))
|
||||
m.Option(ice.MSG_DAEMON, kit.Keys(kit.Slice(kit.Reverse(kit.Simple(source)), 0, -1), p))
|
||||
|
@ -290,14 +290,6 @@ func init() {
|
||||
m.Cmd("", mdb.CREATE, ice.OPS, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]), nfs.REPOS, nfs.USR_ICONS_CONTEXTS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEMO, kit.Select("http://localhost:20000", conf[cli.CTX_DEMO]), "", nfs.USR_ICONS_VOLCANOS)
|
||||
m.Cmd("", mdb.CREATE, ice.MAIL, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]), "", "usr/icons/Mail.png")
|
||||
if m.Cmd(tcp.HOST).Length() == 0 {
|
||||
return
|
||||
}
|
||||
mdb.HashSelects(m.Spawn()).Table(func(value ice.Maps) {
|
||||
kit.If(value[TOKEN], func() {
|
||||
m.Cmd(SPACE, tcp.DIAL, ice.DEV, value[CLIENT_NAME], TOKEN, value[TOKEN], mdb.TYPE, SERVER)
|
||||
})
|
||||
})
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user