| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
a tiny,lightweight rpc module for lua base on libev,easy to use,easy to learn.
see master.lua
see console.lua
see mongo.lua
see redis.lua
see http.lua
see test_kcp_client.lua
see test_kcp_client.lua
see import
see debugger.lua
see event.run_process
ip,port,accept_callback,channel_class or nil
when a new connection coming,accept_callback will be invoke,with arg 1 is listener userdata,arg 2 is the channel obj create by channel_class
ip,port,channel_class or nil
this api must be run in a fork,cause connect op is a call, when connect done,if u specify the channel_class,it will create a channel object by the specify channel_class,otherwise,it will create by default channel class
fd,channel_class or nil
bind a exist fd with the channel class,if the channel_class is nil, it will bind by default channel class
host
resove host
ip,port,callback
start a http server,when a request coming,it will invoke callback with arg 1 is httpd self userdata,arg 2 is request,arg 3 method("POST","GET" and so on),arg 4 url,arg 5 is headers,last is body
key,value
set reply headers with key and value
statu code,reason,body
reply a httpd request
ti,callback
create a timer,it will return a timer object,u can cancel with the function timer:cancel
ti
this api must run in a fork,cause it is a call.it will wakeup after ti second
func,...
the func will run in a new coroutine after a loop with the args ...
lua bind libevent bufferevent
num
read the specify num in bufferevent,if no enough,it will return nil
read line data in bufferevent,if no line,it will return nil
it will close the bufferevent,make sure the buffervent data send out, and the channel.disconnect will be invoke
close the bufferevent immediately ignore the data in buffervent whether send out, the channel.disconnect will not invoke
send data to remote,u can inherit channel class and rewrite the send behaviour
call data to remote,u can inherit channel class and rewrite the call behaviour
lua script reload operation
file
the script can reload after import
file
reload the specity lua script
it will reload all script which modify after last reload
git clone and make,then ./event_tc master to run a simple httpd server
local master_channel = channel:inherit()
function master_channel:disconnect()
handler.leave(self)
end
local function accept(_,channel)
handler.enter(channel)
end
local ok = event.listen("0.0.0.0",env.master,accept,master_channel)
if not ok then
event.error("listen error")
end
event.error(string.format("master listen on:%s",env.master))
for i = 1,env.httpd_max do
event.fork(function ()
while true do
event.run_process("./event_tc httpd")
event.error("httpd down,try again")
event.sleep(1)
end
end)
end
only debug script load by import.lua
to do:trigger lua debugger in gdb
start a debugger while breakpoint in file@line
see profiler.c
u can use gdb script lua.bt to print call stack in gdb
when a dead loop running,u can kill -10 pid to breakout the deadloop
| Back | FazBrowse Home | New Git URL |