mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
- namespace clash with www/lighttpd mod_magnet
upstream is gone, but the port is still quite useful PR: ports/138055 Submitted by: Robert Nagy <robert@openbsd.org>
This commit is contained in:
parent
269e0ebc2e
commit
b91f7f113d
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=260028
2 changed files with 234 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= luasocket
|
PORTNAME= luasocket
|
||||||
PORTVERSION= 2.0.2
|
PORTVERSION= 2.0.2
|
||||||
|
PORTREVISION= 1
|
||||||
CATEGORIES= net
|
CATEGORIES= net
|
||||||
MASTER_SITES= http://luaforge.net/frs/download.php/2664/
|
MASTER_SITES= http://luaforge.net/frs/download.php/2664/
|
||||||
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
|
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
|
||||||
|
|
233
net/luasocket/files/patch-src_buffer_c
Normal file
233
net/luasocket/files/patch-src_buffer_c
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
diff -ru src/buffer.c src/buffer.c
|
||||||
|
--- src/buffer.c 2008-08-20 06:16:42 +0000
|
||||||
|
+++ src/buffer.c 2008-08-20 06:30:15 +0000
|
||||||
|
@@ -33,7 +33,7 @@
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
* Initializes module
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
-int buffer_open(lua_State *L) {
|
||||||
|
+int ls_buffer_open(lua_State *L) {
|
||||||
|
(void) L;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -41,7 +41,7 @@
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
* Initializes C structure
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
-void buffer_init(p_buffer buf, p_io io, p_timeout tm) {
|
||||||
|
+void ls_buffer_init(p_buffer buf, p_io io, p_timeout tm) {
|
||||||
|
buf->first = buf->last = 0;
|
||||||
|
buf->io = io;
|
||||||
|
buf->tm = tm;
|
||||||
|
@@ -52,7 +52,7 @@
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
* object:getstats() interface
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
-int buffer_meth_getstats(lua_State *L, p_buffer buf) {
|
||||||
|
+int ls_buffer_meth_getstats(lua_State *L, p_buffer buf) {
|
||||||
|
lua_pushnumber(L, buf->received);
|
||||||
|
lua_pushnumber(L, buf->sent);
|
||||||
|
lua_pushnumber(L, timeout_gettime() - buf->birthday);
|
||||||
|
@@ -62,7 +62,7 @@
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
* object:setstats() interface
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
-int buffer_meth_setstats(lua_State *L, p_buffer buf) {
|
||||||
|
+int ls_buffer_meth_setstats(lua_State *L, p_buffer buf) {
|
||||||
|
buf->received = (long) luaL_optnumber(L, 2, buf->received);
|
||||||
|
buf->sent = (long) luaL_optnumber(L, 3, buf->sent);
|
||||||
|
if (lua_isnumber(L, 4)) buf->birthday = timeout_gettime() - lua_tonumber(L, 4);
|
||||||
|
@@ -73,7 +73,7 @@
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
* object:send() interface
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
-int buffer_meth_send(lua_State *L, p_buffer buf) {
|
||||||
|
+int ls_buffer_meth_send(lua_State *L, p_buffer buf) {
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
int err = IO_DONE;
|
||||||
|
size_t size = 0, sent = 0;
|
||||||
|
@@ -106,7 +106,7 @@
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
* object:receive() interface
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
-int buffer_meth_receive(lua_State *L, p_buffer buf) {
|
||||||
|
+int ls_buffer_meth_receive(lua_State *L, p_buffer buf) {
|
||||||
|
int err = IO_DONE, top = lua_gettop(L);
|
||||||
|
luaL_Buffer b;
|
||||||
|
size_t size;
|
||||||
|
@@ -149,7 +149,7 @@
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
* Determines if there is any data in the read buffer
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
-int buffer_isempty(p_buffer buf) {
|
||||||
|
+int ls_buffer_isempty(p_buffer buf) {
|
||||||
|
return buf->first >= buf->last;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -244,7 +244,7 @@
|
||||||
|
static void buffer_skip(p_buffer buf, size_t count) {
|
||||||
|
buf->received += count;
|
||||||
|
buf->first += count;
|
||||||
|
- if (buffer_isempty(buf))
|
||||||
|
+ if (ls_buffer_isempty(buf))
|
||||||
|
buf->first = buf->last = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -256,7 +256,7 @@
|
||||||
|
int err = IO_DONE;
|
||||||
|
p_io io = buf->io;
|
||||||
|
p_timeout tm = buf->tm;
|
||||||
|
- if (buffer_isempty(buf)) {
|
||||||
|
+ if (ls_buffer_isempty(buf)) {
|
||||||
|
size_t got;
|
||||||
|
err = io->recv(io->ctx, buf->data, BUF_SIZE, &got, tm);
|
||||||
|
buf->first = 0;
|
||||||
|
diff -ru src/buffer.h src/buffer.h
|
||||||
|
--- src/buffer.h 2008-08-20 06:16:42 +0000
|
||||||
|
+++ src/buffer.h 2008-08-20 06:30:15 +0000
|
||||||
|
@@ -36,12 +36,12 @@
|
||||||
|
} t_buffer;
|
||||||
|
typedef t_buffer *p_buffer;
|
||||||
|
|
||||||
|
-int buffer_open(lua_State *L);
|
||||||
|
-void buffer_init(p_buffer buf, p_io io, p_timeout tm);
|
||||||
|
-int buffer_meth_send(lua_State *L, p_buffer buf);
|
||||||
|
-int buffer_meth_receive(lua_State *L, p_buffer buf);
|
||||||
|
-int buffer_meth_getstats(lua_State *L, p_buffer buf);
|
||||||
|
-int buffer_meth_setstats(lua_State *L, p_buffer buf);
|
||||||
|
-int buffer_isempty(p_buffer buf);
|
||||||
|
+int ls_buffer_open(lua_State *L);
|
||||||
|
+void ls_buffer_init(p_buffer buf, p_io io, p_timeout tm);
|
||||||
|
+int ls_buffer_meth_send(lua_State *L, p_buffer buf);
|
||||||
|
+int ls_buffer_meth_receive(lua_State *L, p_buffer buf);
|
||||||
|
+int ls_buffer_meth_getstats(lua_State *L, p_buffer buf);
|
||||||
|
+int ls_buffer_meth_setstats(lua_State *L, p_buffer buf);
|
||||||
|
+int ls_buffer_isempty(p_buffer buf);
|
||||||
|
|
||||||
|
#endif /* BUF_H */
|
||||||
|
diff -ru src/luasocket.c src/luasocket.c
|
||||||
|
--- src/luasocket.c 2008-08-20 06:16:42 +0000
|
||||||
|
+++ src/luasocket.c 2008-08-20 06:30:15 +0000
|
||||||
|
@@ -51,7 +51,7 @@
|
||||||
|
{"auxiliar", auxiliar_open},
|
||||||
|
{"except", except_open},
|
||||||
|
{"timeout", timeout_open},
|
||||||
|
- {"buffer", buffer_open},
|
||||||
|
+ {"buffer", ls_buffer_open},
|
||||||
|
{"inet", inet_open},
|
||||||
|
{"tcp", tcp_open},
|
||||||
|
{"udp", udp_open},
|
||||||
|
diff -ru src/tcp.c src/tcp.c
|
||||||
|
--- src/tcp.c 2008-08-20 06:16:42 +0000
|
||||||
|
+++ src/tcp.c 2008-08-20 06:30:15 +0000
|
||||||
|
@@ -104,22 +104,22 @@
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
static int meth_send(lua_State *L) {
|
||||||
|
p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
|
||||||
|
- return buffer_meth_send(L, &tcp->buf);
|
||||||
|
+ return ls_buffer_meth_send(L, &tcp->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int meth_receive(lua_State *L) {
|
||||||
|
p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
|
||||||
|
- return buffer_meth_receive(L, &tcp->buf);
|
||||||
|
+ return ls_buffer_meth_receive(L, &tcp->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int meth_getstats(lua_State *L) {
|
||||||
|
p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
|
||||||
|
- return buffer_meth_getstats(L, &tcp->buf);
|
||||||
|
+ return ls_buffer_meth_getstats(L, &tcp->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int meth_setstats(lua_State *L) {
|
||||||
|
p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1);
|
||||||
|
- return buffer_meth_setstats(L, &tcp->buf);
|
||||||
|
+ return ls_buffer_meth_setstats(L, &tcp->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
@@ -152,7 +152,7 @@
|
||||||
|
static int meth_dirty(lua_State *L)
|
||||||
|
{
|
||||||
|
p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1);
|
||||||
|
- lua_pushboolean(L, !buffer_isempty(&tcp->buf));
|
||||||
|
+ lua_pushboolean(L, !ls_buffer_isempty(&tcp->buf));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -176,7 +176,7 @@
|
||||||
|
io_init(&clnt->io, (p_send) socket_send, (p_recv) socket_recv,
|
||||||
|
(p_error) socket_ioerror, &clnt->sock);
|
||||||
|
timeout_init(&clnt->tm, -1, -1);
|
||||||
|
- buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
|
||||||
|
+ ls_buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
@@ -329,7 +329,7 @@
|
||||||
|
io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv,
|
||||||
|
(p_error) socket_ioerror, &tcp->sock);
|
||||||
|
timeout_init(&tcp->tm, -1, -1);
|
||||||
|
- buffer_init(&tcp->buf, &tcp->io, &tcp->tm);
|
||||||
|
+ ls_buffer_init(&tcp->buf, &tcp->io, &tcp->tm);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
diff -ru src/unix.c src/unix.c
|
||||||
|
--- src/unix.c 2008-08-20 06:16:42 +0000
|
||||||
|
+++ src/unix.c 2008-08-20 06:30:15 +0000
|
||||||
|
@@ -105,22 +105,22 @@
|
||||||
|
\*-------------------------------------------------------------------------*/
|
||||||
|
static int meth_send(lua_State *L) {
|
||||||
|
p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
|
||||||
|
- return buffer_meth_send(L, &un->buf);
|
||||||
|
+ return ls_buffer_meth_send(L, &un->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int meth_receive(lua_State *L) {
|
||||||
|
p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
|
||||||
|
- return buffer_meth_receive(L, &un->buf);
|
||||||
|
+ return ls_buffer_meth_receive(L, &un->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int meth_getstats(lua_State *L) {
|
||||||
|
p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
|
||||||
|
- return buffer_meth_getstats(L, &un->buf);
|
||||||
|
+ return ls_buffer_meth_getstats(L, &un->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int meth_setstats(lua_State *L) {
|
||||||
|
p_unix un = (p_unix) auxiliar_checkclass(L, "unix{client}", 1);
|
||||||
|
- return buffer_meth_setstats(L, &un->buf);
|
||||||
|
+ return ls_buffer_meth_setstats(L, &un->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------*\
|
||||||
|
@@ -149,7 +149,7 @@
|
||||||
|
|
||||||
|
static int meth_dirty(lua_State *L) {
|
||||||
|
p_unix un = (p_unix) auxiliar_checkgroup(L, "unix{any}", 1);
|
||||||
|
- lua_pushboolean(L, !buffer_isempty(&un->buf));
|
||||||
|
+ lua_pushboolean(L, !ls_buffer_isempty(&un->buf));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -172,7 +172,7 @@
|
||||||
|
io_init(&clnt->io, (p_send)socket_send, (p_recv)socket_recv,
|
||||||
|
(p_error) socket_ioerror, &clnt->sock);
|
||||||
|
timeout_init(&clnt->tm, -1, -1);
|
||||||
|
- buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
|
||||||
|
+ ls_buffer_init(&clnt->buf, &clnt->io, &clnt->tm);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
@@ -346,7 +346,7 @@
|
||||||
|
io_init(&un->io, (p_send) socket_send, (p_recv) socket_recv,
|
||||||
|
(p_error) socket_ioerror, &un->sock);
|
||||||
|
timeout_init(&un->tm, -1, -1);
|
||||||
|
- buffer_init(&un->buf, &un->io, &un->tm);
|
||||||
|
+ ls_buffer_init(&un->buf, &un->io, &un->tm);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
Loading…
Add table
Reference in a new issue