Code Monkey home page Code Monkey logo

distri.lua's Introduction

distri.lua(discard,See Chuck)

distri.lua is a lua concurrency networking framework aid to help the developer to fast build online game server ,web application,light distributed system and so on.

Features include:

  • Fast event loop
  • Supported TCP and UDP
  • Cooperative socket library
  • RPC framework
  • Supported Linux and FreeBSD
  • Cooperative dns query
  • Lighted HttpServer
  • SSL Connection
  • WebSocket
  • local and remote debug of lua
  • integrate redis client interface(Synchronous and asynchronous)

distri.lua is licensed under GPL license.

get distri.lua

Install lua 5.2.

Clone the repository.

Post feedback and issues on the bug tracker,

build

in Ubuntu

sudo apt-get install libssl-dev
sudo apt-get install libreadline-dev

make

in FreeBSD

gmake

running tests

pingpong test

./distrilua samples/hello.lua
./distrilua samples/pingclient.lua

rpc test

./distrilua samples/rpcserver.lua
./distrilua samples/rpcclient.lua

to-do list

  • Cooperative dns query
  • WebSocket
  • debuger

http test

local Http = require "lua/http"
Http.CreateServer(function (req, res) 
    res:WriteHead(200,"OK", {"Content-Type: text/plain"})
    res:End("Hello World\n");
    end):Listen("127.0.0.1",8001)

print("create server on 127.0.0.1 8001")

udp test

server

local Socket = require "lua.socket"
local Timer = require "lua.timer"
local Sche = require "lua.sche"

local count = 0
local s = Socket.Datagram.New(CSocket.AF_INET,1024,Socket.Datagram.RDecoder())
s:Listen("127.0.0.1",8010)


Sche.Spawn(function ()
	while true do
		local rpk,from = s:Recv()
		--print(from[1],from[2],from[3])
		count = count + 1
		s:Send(Socket.WPacket(rpk),from)
	end
end)

local last = C.GetSysTick()
local timer = Timer.New():Register(function ()
	local now = C.GetSysTick()
	print(string.format("count:%d",count*1000/(now-last)))
	count = 0
	last = now
end,1000):Run()

client

local Socket = require "lua.socket"

local s = Socket.Datagram.New(CSocket.AF_INET,1024,Socket.Datagram.RDecoder())
for i = 1,3 do
	local wpk = Socket.WPacket(1024)
	wpk:Write_string("hello")
	s:Send(wpk,{CSocket.AF_INET,"127.0.0.1",8010})
end

while true do
	local rpk,from = s:Recv()
	s:Send(Socket.WPacket(rpk),from)
end

RPC test

server

local TcpServer = require "lua.tcpserver"
local App = require "lua.application"
local RPC = require "lua.rpc"
local Timer = require "lua.timer"
local Sche = require "lua.sche"
local Socket = require "lua.socket"


local count = 0

local rpcserver = App.New()

rpcserver:RPCService("Plus",function (_,a,b)
	count = count + 1 
	return a+b 
end)

local success

local success = not TcpServer.Listen("127.0.0.1",8000,function (client)
			print("on new client")		
			rpcserver:Add(client:Establish(Socket.Stream.RDecoder()))		
	end)


if success then
	print("server start on 127.0.0.1:8000")
	local last = C.GetSysTick()
	local timer = Timer.New():Register(function ()
		local now = C.GetSysTick()
		print(string.format("cocount:%d,rpccount:%d,elapse:%d",
				     Sche.GetCoCount(),count*1000/(now-last),now-last))
		count = 0
		last = now
	end,1000):Run()
else
	print("server start error")
end

client

local Socket = require "lua.socket"
local App = require "lua.application"
local RPC = require "lua.rpc"
local Sche = require "lua.sche"

local rpcclient = App.New()

for i=1,10 do
	Sche.Spawn(function () 
		local client = Socket.Stream.New(CSocket.AF_INET)
		if client:Connect("127.0.0.1",8000) then
			print("connect to 127.0.0.1:8000 error")
			return
		end		
		rpcclient:Add(client:Establish(Socket.Stream.RDecoder()),nil,on_disconnected)
		local rpcHandler = RPC.MakeRPC(client,"Plus")
		for j=1,100 do
			Sche.Spawn(function (client)
				while true do			
					local err,ret = rpcHandler:Call(1,2)
					if err then
						print("rpc error:" .. err)
						client:Close()
						return
					end
				end
			end,client)
		end
	end)	
end

test redis client

local Redis = require "lua.redis"
local Sche = require "lua.sche"
local Timer = require "lua.timer"


local count = 0
local toredis

local function connect_to_redis()
	print("here")
    if toredis then
		print("to redis disconnected")
    end
    toredis = nil
	Sche.Spawn(function ()
		while true do
			local err
			err,toredis = Redis.Connect("127.0.0.1",6379,connect_to_redis)
			if toredis then
				break
			end
			print("try to connect after 1 sec")
			Sche.Sleep(1000)
		end
	end)	
end

connect_to_redis()

while not toredis do
	Sche.Yield()
end

local err,result = toredis:CommandSync("hmget test nickname")

if result then
	for k,v in pairs(result) do
		print(k,v)
	end
end

demo of online game

see Survive

distri.lua's People

Contributors

harukama avatar sniperhw avatar wagulu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

distri.lua's Issues

你好,今天看到你的这个项目,我之前有用luvit希望多交流

你好,今天看到你的这个项目,我之前有用luvit。希望多交流。有群加嘛。我对服务端lua的应用比较感兴趣。我也是做游戏的。前端用的Lua.后端战斗运算用的Luvit【比较老的版本】。不过目前使用上发现luvit有比较严重的内存问题。luvit的新版本有点向node的模式在靠,反而感觉很难用。今天才发现你的这个项目。

这个对gcc版本有要求的把?

我在家用centos7 gcc 4.8编译没问题
在公司的centos6 gcc 4.4.7 编译 kendynet报错:

[root@localhost distri.lua-master]# make
cd KendyNet; make release
make[1]: Entering directory /home/bianjian/distri.lua-master/KendyNet' cc -fPIC -O2 -g -Wall -fno-strict-aliasing -c src/kn_engine.c src/kn_timerfd.c src/kn_timer.c src/kn_time.c src/redisconn.c src/kn_refobj.c src/rpacket.c src/wpacket.c src/packet.c src/kn_socket.c src/kn_refobj.c src/connection.c src/kn_thread.c src/kn_thread_mailbox.c src/kn_except.c src/lookup8.c src/spinlock.c src/log.c src/kn_string.c src/minheap.c src/tls.c src/rbtree.c src/kn_daemonize.c src/lua_util.c src/kn_objpool.c src/kn_chr_dev.c src/kendynet.c src/kn_stream_socket.c src/kn_datagram_socket.c src/datagram.c src/lua_util_packet.c src/hash_map.c src/buffer.c -I./include -I./src -I./ -I../deps -I../deps/lua-5.3.0/src -D_LINUX In file included from ./include/kendynet.h:8, from src/kendynet_private.h:3, from src/kn_epoll.h:4, from src/kn_engine.c:3: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from ./include/kn_timer.h:21, from src/kn_timerfd.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from src/kendynet_private.h:3, from src/kn_timer.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) src/kn_timer.c: At top level: src/kn_timer.c:45: error: redefinition of typedef ‘kn_timer_t’ ./include/kn_timer.h:30: note: previous declaration of ‘kn_timer_t’ was here src/kn_timer.c:50: error: redefinition of typedef ‘wheelmgr_t’ src/kn_timer_private.h:16: note: previous declaration of ‘wheelmgr_t’ was here In file included from src/kn_time.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from src/kendynet_private.h:3, from src/redisconn.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from src/kn_refobj.c:1: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from src/kn_refobj.c:2: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from ./include/rpacket.h:19, from src/rpacket.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/buffer.h:27, from ./include/packet.h:20, from ./include/rpacket.h:20, from src/rpacket.c:1: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/kendynet.h:8, from ./include/wpacket.h:20, from src/wpacket.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/buffer.h:27, from ./include/packet.h:20, from ./include/wpacket.h:21, from src/wpacket.c:1: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/kendynet.h:8, from src/packet.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/buffer.h:27, from ./include/packet.h:20, from src/packet.c:2: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/kendynet.h:8, from src/kendynet_private.h:3, from src/kn_type.h:3, from src/kn_socket.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from src/kn_refobj.c:1: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from src/kn_refobj.c:2: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from ./include/connection.h:5, from src/connection.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/buffer.h:27, from ./include/packet.h:20, from ./include/connection.h:6, from src/connection.c:1: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/kn_thread_sync.h:25, from ./include/kn_thread.h:21, from src/kn_thread.c:2: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kn_thread_mailbox.h:4, from src/kn_thread_mailbox.c:4: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/kendynet.h:8, from ./include/kn_thread_mailbox.h:5, from src/kn_thread_mailbox.c:4: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) src/kn_thread_mailbox.c: In function ‘create_mailbox’: src/kn_thread_mailbox.c:124: warning: statement with no effect src/kn_thread_mailbox.c: In function ‘kn_setup_mailbox’: src/kn_thread_mailbox.c:157: error: unknown field ‘identity’ specified in initializer src/kn_thread_mailbox.c:157: warning: missing braces around initializer src/kn_thread_mailbox.c:157: warning: (near initialization for ‘mailbox.<anonymous>’) src/kn_thread_mailbox.c:157: error: unknown field ‘ptr’ specified in initializer src/kn_thread_mailbox.c:157: warning: excess elements in struct initializer src/kn_thread_mailbox.c:157: warning: (near initialization for ‘mailbox’) In file included from ./include/kn_thread_sync.h:25, from ./include/kn_thread.h:21, from src/log.c:3: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kn_thread_mailbox.h:4, from src/log.c:7: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from src/kn_string.c:5: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/kendynet.h:8, from src/kendynet_private.h:3, from src/kn_type.h:3, from src/kn_chr_dev.c:3: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from src/kendynet.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from src/kendynet_private.h:3, from src/kn_type.h:3, from src/kn_socket.h:4, from src/kn_stream_socket.h:4, from src/kn_stream_socket.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from src/kendynet_private.h:3, from src/kn_type.h:3, from src/kn_socket.h:4, from src/kn_datagram_socket.h:4, from src/kn_datagram_socket.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/kendynet.h:8, from ./include/datagram.h:4, from src/datagram.c:1: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/buffer.h:27, from ./include/packet.h:20, from ./include/datagram.h:5, from src/datagram.c:1: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/kendynet.h:8, from ./include/wpacket.h:20, from ./include/lua/lua_util_packet.h:4, from src/lua_util_packet.c:2: ./include/kn_time.h: In function ‘_clock_gettime_boot’: ./include/kn_time.h:41: error: ‘CLOCK_BOOTTIME’ undeclared (first use in this function) ./include/kn_time.h:41: error: (Each undeclared identifier is reported only once ./include/kn_time.h:41: error: for each function it appears in.) In file included from ./include/buffer.h:27, from ./include/packet.h:20, from ./include/wpacket.h:21, from ./include/lua/lua_util_packet.h:4, from src/lua_util_packet.c:2: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) In file included from ./include/buffer.h:27, from src/buffer.c:4: ./include/kn_refobj.h: In function ‘make_ident’: ./include/kn_refobj.h:70: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:70: warning: missing braces around initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous).<anonymous>’) ./include/kn_refobj.h:70: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:70: warning: excess elements in struct initializer ./include/kn_refobj.h:70: warning: (near initialization for ‘(anonymous)’) ./include/kn_refobj.h: At top level: ./include/kn_refobj.h:73: error: unknown field ‘identity’ specified in initializer ./include/kn_refobj.h:73: warning: missing braces around initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident.<anonymous>’) ./include/kn_refobj.h:73: error: unknown field ‘ptr’ specified in initializer ./include/kn_refobj.h:73: warning: excess elements in struct initializer ./include/kn_refobj.h:73: warning: (near initialization for ‘empty_ident’) make[1]: *** [release] Error 1 make[1]: Leaving directory/home/bianjian/distri.lua-master/KendyNet'
make: *** [KendyNet/libkendynet.a] Error 2

这个框架是单线程的吗?

看了下代码,主线程一直有个循环去wait IO事件,整个进程没有创建新的线程。这样怎么利用多核的优势?还是实际开发的时候开多个进程?
如果用多线程模式,一个io线程,多个worker线程,共享一个lua虚拟机,这样可行不?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.