close socket after using, remove unused forward declarations
This commit is contained in:
parent
61b50c8fe8
commit
73af2f4451
|
@ -69,6 +69,8 @@ int oct_network_node_init(char* port, lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
OCT_LOG_INFO("Listening on 127.0.0.1 port %s", port);
|
||||
|
||||
lua_pushcfunction(L, oct_network_recv_msg_lua);
|
||||
lua_setglobal(L, "oct_recv");
|
||||
lua_pushcfunction(L, oct_network_send_msg_lua);
|
||||
|
@ -147,6 +149,7 @@ int oct_network_send_msg() {
|
|||
return -1;
|
||||
}
|
||||
oct_network_node.needs_send = 0;
|
||||
close(sfd);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,10 @@
|
|||
#include <lua5.3/lualib.h>
|
||||
|
||||
#define BUFFER_SIZE 1024
|
||||
#define NUM_BUFFERS 10;
|
||||
|
||||
#define OCT_DEFAULT_PORT "20000"
|
||||
|
||||
// Forward declarations
|
||||
struct oct_network_client;
|
||||
struct oct_network_server;
|
||||
|
||||
|
||||
int oct_network_node_init(char* port, lua_State* L);
|
||||
int oct_network_node_deinit();
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
-- Useful constants
|
||||
OCT_NEEDS_NETWORKING = 1;
|
||||
OCT_NOT_NEEDS_NETWORKING = 0;
|
||||
OCT_NEEDS_TERMBOX = 1;
|
||||
OCT_NOT_NEEDS_TERMBOX = 0;
|
||||
|
||||
-- Load a sprite stored in a .txt file
|
||||
function load_termbox_sprite(file_name)
|
||||
file = io.open(file_name, "r");
|
||||
|
@ -7,8 +13,4 @@ function load_termbox_sprite(file_name)
|
|||
return contents;
|
||||
end
|
||||
|
||||
OCT_NEEDS_NETWORKING = 1;
|
||||
OCT_NOT_NEEDS_NETWORKING = 0;
|
||||
OCT_NEEDS_TERMBOX = 1;
|
||||
OCT_NOT_NEEDS_TERMBOX = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue