diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2023-11-24 21:47:03 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2023-11-24 21:47:03 -0600 |
| commit | dddf5303cd3f9f8c46ee82b4e15549b2de32951e (patch) | |
| tree | 7e1f2975a2ce3f38574f076d095fc7321fde4b1e | |
| parent | b26614f10d13835c8a9b6856abcad6ad057c904e (diff) | |
| download | brokengine-dddf5303cd3f9f8c46ee82b4e15549b2de32951e.tar.gz brokengine-dddf5303cd3f9f8c46ee82b4e15549b2de32951e.tar.bz2 brokengine-dddf5303cd3f9f8c46ee82b4e15549b2de32951e.zip | |
Revert "Add a bunch of debugging around the network recieve function"
This reverts commit 4a2baf0045a5acdb76629ff72f35bc1ac7606ff7.
| -rw-r--r-- | src/shared/lua_api/load_net.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/shared/lua_api/load_net.cpp b/src/shared/lua_api/load_net.cpp index 57075ab..8a44d75 100644 --- a/src/shared/lua_api/load_net.cpp +++ b/src/shared/lua_api/load_net.cpp @@ -365,45 +365,45 @@ int block_recv(lua_State *L){//{socket} void gameloop_net(lua_State* L){ assert(lua_gettop(L) == 0); - printf("Doing net of gameloop,starting with %d args\n",lua_gettop(L)); - printf("Got net\n"); + //printf("Doing net of gameloop,starting with %d args\n",lua_gettop(L)); + //printf("Got net\n"); lua_getglobal(L,"net");//{net} lua_getfield(L,-1,"sockets");//{net},{sockets} lua_pushnil(L);//{net},{sockets},nil - printf("Found sockets\n"); + //printf("Found sockets\n"); while(lua_next(L,-2) != 0){ - printf("Got first socket value\n"); + //printf("Got first socket value\n"); //{net},{sockets},{socket},true - printf("%s - %s\n",lua_typename(L,lua_type(L,-2)),lua_typename(L,lua_type(L,-1))); + //printf("%s - %s\n",lua_typename(L,lua_type(L,-2)),lua_typename(L,lua_type(L,-1))); lua_getfield(L,-2,"fd");//{net},{sockets},{socket},true,fd nng_socket *socket = (nng_socket*)lua_touserdata(L,-1); lua_getfield(L,-3,"n");//{net},{sockets},{socket},true,fd,type int stype = lua_tonumber(L,-1); - printf("Got a socket of type %d\n",stype); + //printf("Got a socket of type %d\n",stype); lua_pop(L,3);//{net},{sockets},{socket}//Keep key for next iteration of lua_next() if(!socket_can_receive(stype)){ - printf("Socket cannot receive, breaking!\n"); + //printf("Socket cannot receive, breaking!\n"); continue; } - printf("About to push errorfunc\n"); + //printf("About to push errorfunc\n"); pusherrorfunc(L);//{net},{sockets},{socket},errfunc() - printf("Done pushing errorfunc\n"); + //printf("Done pushing errorfunc\n"); lua_getfield(L,-2,"receive");//{net},{sockets},{socket},errfunc(),(socket.receive | nil) - printf("Got field\n"); + //printf("Got field\n"); if(lua_isnil(L,-1)){//Make sure we have a receive - printf("Listen-able socket type %d has no .receive method\n",stype); + //printf("Listen-able socket type %d has no .receive method\n",stype); lua_pop(L,2); continue; } //{net},{sockets},{socket},socket.receive - printf("Right before recv\n"); + //printf("Right before recv\n"); nng_msg *msgp; - printf("About to recvmsg(), socket: %p, msgp: %p\n",socket,msgp); + //printf("About to recvmsg(), socket: %p, msgp: %p\n",socket,msgp); int err = nng_recvmsg(*socket,&msgp,NNG_FLAG_NONBLOCK); //size_t recvsize; //char *buf; //int err = nng_recv(*socket,&buf,&recvsize,NNG_FLAG_NONBLOCK); - printf("Done with recvmsg() err: %d:\n",err); + //printf("Done with recvmsg() err: %d:\n",err); if(err){ switch(err){ case NNG_EAGAIN: break; @@ -418,9 +418,9 @@ void gameloop_net(lua_State* L){ } lua_pop(L,2); }else{ - printf("Actually receving message\n"); + //printf("Actually receving message\n"); char* buf = (char*)nng_msg_body(msgp); - printf("Got message body\n"); + //printf("Got message body\n"); size_t size = nng_msg_len(msgp); //size_t size = recvsize; //printf("Got mesage body\n"); @@ -428,7 +428,7 @@ void gameloop_net(lua_State* L){ stream->length = size; stream->data = buf; //stream_print(stream); - printf("Created stream and everything\n"); + //printf("Created stream and everything\n"); lua_pushvalue(L,-4);//{net},{sockets},{socket},errfunc(),socket.receive(),{socket},{} lua_newtable(L);//{net},{sockets},{socket},errfunc(),socket.receive(),{socket},{} @@ -436,16 +436,16 @@ void gameloop_net(lua_State* L){ lua_setfield(L,-2,"data");//{net},{sockets},{socket},errfunc(),socket.receive(),{socket},{data=stream} luaL_getmetatable(L,"net.stream");//{net},{sockets},{socket},errfunc(),socket.receive(),{socket},{data=stream},{net.stream} lua_setmetatable(L,-2);//{net},{sockets},{socket},errfunc(),socket.receive(),{socket},{stream} - printf("About to call receive function\n"); + //printf("About to call receive function\n"); lua_pcall(L,2,0,-4);//{net},{sockets},{socket},errfunc() lua_pop(L,1); - printf("Finished calling receive function\n"); - printf("Finished calling gameloop, buf is %p, size is %zu\n",buf,size); + //printf("Finished calling receive function\n"); + //printf("Finished calling gameloop, buf is %p, size is %zu\n",buf,size); nng_msg_free(msgp); //nng_free(buf,size); - printf("called nn_freemsg\n"); + //printf("called nn_freemsg\n"); free(stream);//We manually set stream->data so free_stream would crash here - printf("Called free on stream\n"); + //printf("Called free on stream\n"); } } |
