Code Monkey home page Code Monkey logo

battlearena's Issues

这段代码有可能死循环

local function send_request(self, data)
local n = #data
local sb = self.__fd:send(data)
if not sb then
closefd(self)
return
end
local unsend = sb + 1
while sb < n do
n = n - sb
local sb = self.__fd:send(v.data:sub(unsend))
if not sb then
closefd(self)
return
end
unsend = unsend + sb
end
end

当网络情况比较差,第一次SEND失败,从第二次SEND开始就会死循环,原因是定义了两个local sb

mac下编译后执行的问题

google了一晚,没搜到结果,还是来麻烦云风大侠了 @cloudwu

[:~/macdev/battlearena/client]$ which lua                                                                                         
/usr/local/bin/lua
[:~/macdev/battlearena/client]$ lua -v                                                                                            
Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio

-std=gnu99, 这个是我加的,加与不加,结果一样

[:~/macdev/battlearena/client]$ make                                                                                              (master✱)
cd lsocket && /Applications/Xcode.app/Contents/Developer/usr/bin/make
cc -bundle -undefined dynamic_lookup -all_load  -o lsocket.so lsocket.o
gcc -std=gnu99 -O2 -Wall -fPIC -bundle -undefined dynamic_lookup -all_load -llua -o timesync.so timesync.c -I/usr/local/include
timesync.c:120:2: warning: implicit declaration of function 'luaL_checkversion' is invalid in C99 [-Wimplicit-function-declaration]
        luaL_checkversion(L);
        ^
timesync.c:128:2: warning: implicit declaration of function 'luaL_newlibtable' is invalid in C99 [-Wimplicit-function-declaration]
        luaL_newlibtable(L,l);
        ^
timesync.c:131:2: warning: implicit declaration of function 'luaL_setfuncs' is invalid in C99 [-Wimplicit-function-declaration]
        luaL_setfuncs(L,l,1);
        ^
3 warnings generated

[:~/macdev/battlearena]$ ./client.sh                                                                                              (master✱)
lua: error loading module 'timesync' from file 'client/timesync.so':
    dlopen(client/timesync.so, 6): Symbol not found: _luaL_checkversion
  Referenced from: client/timesync.so
  Expected in: flat namespace
 in client/timesync.so
stack traceback:
    [C]: in ?
    [C]: in function 'require'
    client/socket.lua:3: in main chunk
    [C]: in function 'require'
    client/main.lua:1: in main chunk
    [C]: in ?

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.