mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-25 12:08:21 +01:00
Compiles with g++.
This commit is contained in:
parent
a7d5362caf
commit
197aef23ce
6
TODO
6
TODO
@ -16,7 +16,6 @@ optmize aux_getgroupudata
|
||||
use one upvalue per string name of class/group
|
||||
make aux_checkgroup by upvalue (faster)
|
||||
|
||||
fix local domain socket kludge of name size
|
||||
|
||||
make sure all modules that can use it actually use socket.newtry
|
||||
adicionar exemplos de expansão: pipe, local, named pipe
|
||||
@ -27,4 +26,7 @@ testar os options!
|
||||
- proteger get*by*.* com um mutex GLOBAL!
|
||||
- proteger ou atomizar o conjunto (timedout, receive), (timedout, send)
|
||||
- inet_ntoa também é uma merda.
|
||||
- SSL
|
||||
|
||||
|
||||
*fix local domain socket kludge of name size
|
||||
*use TLS
|
||||
|
10
etc/lp.lua
10
etc/lp.lua
@ -1,6 +1,12 @@
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- LPD support for the Lua language
|
||||
-- LuaSocket toolkit.
|
||||
-- Author: David Burgess
|
||||
-- Modified by Diego Nehab, but David is in charge
|
||||
-- RCS ID: $Id$
|
||||
-----------------------------------------------------------------------------
|
||||
--[[
|
||||
if you have any questions RFC 1179
|
||||
if you have any questions: RFC 1179
|
||||
]]
|
||||
-- make sure LuaSocket is loaded
|
||||
local socket = require("socket")
|
||||
|
@ -4,8 +4,9 @@
|
||||
*
|
||||
* RCS ID: $Id$
|
||||
\*=========================================================================*/
|
||||
#include <lauxlib.h>
|
||||
#include <stdio.h>
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
|
||||
#include "except.h"
|
||||
|
||||
@ -14,7 +15,7 @@
|
||||
\*=========================================================================*/
|
||||
static int global_protect(lua_State *L);
|
||||
static int global_newtry(lua_State *L);
|
||||
static int protected(lua_State *L);
|
||||
static int protected_(lua_State *L);
|
||||
static int finalize(lua_State *L);
|
||||
static int do_nothing(lua_State *L);
|
||||
|
||||
@ -53,7 +54,7 @@ static int global_newtry(lua_State *L) {
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Protect factory
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int protected(lua_State *L) {
|
||||
static int protected_(lua_State *L) {
|
||||
lua_pushvalue(L, lua_upvalueindex(1));
|
||||
lua_insert(L, 1);
|
||||
if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) {
|
||||
@ -64,7 +65,7 @@ static int protected(lua_State *L) {
|
||||
}
|
||||
|
||||
static int global_protect(lua_State *L) {
|
||||
lua_pushcclosure(L, protected, 1);
|
||||
lua_pushcclosure(L, protected_, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ static int meth_receive(lua_State *L)
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int meth_setoption(lua_State *L)
|
||||
{
|
||||
p_tcp tcp = aux_checkgroup(L, "tcp{any}", 1);
|
||||
p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1);
|
||||
return opt_meth_setoption(L, opt, &tcp->sock);
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ static int meth_accept(lua_State *L)
|
||||
const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
|
||||
/* if successful, push client socket */
|
||||
if (!err) {
|
||||
p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp));
|
||||
p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp));
|
||||
aux_setclass(L, "tcp{client}", -1);
|
||||
/* initialize structure fields */
|
||||
sock_setnonblocking(&sock);
|
||||
|
@ -111,7 +111,7 @@ static int meth_receive(lua_State *L) {
|
||||
* Just call option handler
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int meth_setoption(lua_State *L) {
|
||||
p_unix unix = aux_checkgroup(L, "unix{any}", 1);
|
||||
p_unix unix = (p_unix) aux_checkgroup(L, "unix{any}", 1);
|
||||
return opt_meth_setoption(L, opt, &unix->sock);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ static int meth_accept(lua_State *L) {
|
||||
const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm);
|
||||
/* if successful, push client socket */
|
||||
if (!err) {
|
||||
p_unix clnt = lua_newuserdata(L, sizeof(t_unix));
|
||||
p_unix clnt = (p_unix) lua_newuserdata(L, sizeof(t_unix));
|
||||
aux_setclass(L, "unix{client}", -1);
|
||||
/* initialize structure fields */
|
||||
sock_setnonblocking(&sock);
|
||||
|
Loading…
Reference in New Issue
Block a user