代码拉取完成,页面将自动刷新
同步操作将从 Cyinx/einx 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package einx
import (
"github.com/Cyinx/einx/console"
"github.com/Cyinx/einx/event"
"github.com/Cyinx/einx/lua"
"github.com/Cyinx/einx/module"
"github.com/Cyinx/einx/network"
"github.com/Cyinx/einx/slog"
"os"
"os/signal"
)
var _einx_default = &einx{
close_chan: make(chan bool),
}
func Init(opts ...Option) {
for _, opt := range opts {
opt()
}
}
func Run() {
slog.Run()
console.Run()
network.Run()
module.Start()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
sig := <-c
slog.LogWarning("einx", "einx will close down (signal: %v)", sig)
_einx_default.do_close()
}
func Close() {
_einx_default.close()
slog.Close()
}
func GetModule(name string) Module {
return module.GetModule(name)
}
func NewLuaStae() *lua_state.LuaRuntime {
return lua_state.NewLuaStae()
}
func AddTcpServerMgr(m module.Module, addr string, mgr interface{}, opts ...Option) {
m_eventer := m.(event.EventReceiver)
opts = append(opts, NetworkOption.ListenAddr(addr))
opts = append(opts, network.Module(m_eventer))
opts = append(opts, NetworkOption.ServeHandler(mgr.(SessionHandler)))
tcp_server := network.NewTcpServerMgr(opts...)
e := &event.ComponentEventMsg{}
e.MsgType = event.EVENT_COMPONENT_CREATE
e.Sender = tcp_server
e.Attach = mgr
m_eventer.PushEventMsg(e)
}
func StartTcpClientMgr(m module.Module, name string, mgr interface{}, opts ...Option) {
m_eventer := m.(event.EventReceiver)
opts = append(opts, NetworkOption.Name(name))
opts = append(opts, network.Module(m_eventer))
opts = append(opts, NetworkOption.ServeHandler(mgr.(SessionHandler)))
tcp_client := network.NewTcpClientMgr(opts...)
e := &event.ComponentEventMsg{}
e.MsgType = event.EVENT_COMPONENT_CREATE
e.Sender = tcp_client
e.Attach = mgr
m_eventer.PushEventMsg(e)
}
func AddModuleComponent(m module.Module, c Component, mgr interface{}) {
m_eventer := m.(event.EventReceiver)
e := &event.ComponentEventMsg{}
e.MsgType = event.EVENT_COMPONENT_CREATE
e.Sender = c
e.Attach = mgr
m_eventer.PushEventMsg(e)
}
func CreateModuleWorkers(name string, size int) WorkerPool {
return module.CreateWorkers(name, size)
}
func GetWorkerPool(name string) WorkerPool {
return module.GetWorkerPool(name)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。