summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rhnop-server/l_pipe.c8
-rw-r--r--rhnop-server/nopsyncd.c14
-rw-r--r--rhnop-server/qlistener.lua5
3 files changed, 14 insertions, 13 deletions
diff --git a/rhnop-server/l_pipe.c b/rhnop-server/l_pipe.c
index 4a30ee5..1cd8e49 100644
--- a/rhnop-server/l_pipe.c
+++ b/rhnop-server/l_pipe.c
@@ -58,7 +58,7 @@ static int l_pipe_signal(lua_State *L)
break;
}
-
+
lua_pushinteger(L, ret);
return 1;
}
@@ -69,7 +69,7 @@ static int l_pipe_getfd(lua_State *L)
luaL_error(L, "can't retreive pipe fd");
lua_pushliteral(L, "fd");
- lua_gettable(L, -2);
+ lua_gettable(L, -2);
return 1;
}
@@ -112,9 +112,9 @@ static int l_pipe_consume(lua_State *L)
if(len >= sizeof(data)) {
ret = 0;
break;
- }
+ }
}
-
+
if(ret)
lua_pushstring(L, data);
else
diff --git a/rhnop-server/nopsyncd.c b/rhnop-server/nopsyncd.c
index 376ff8f..35558c2 100644
--- a/rhnop-server/nopsyncd.c
+++ b/rhnop-server/nopsyncd.c
@@ -42,9 +42,9 @@ static const luaL_Reg nopsyncd_lualibs[] = {
{LUA_TABLIBNAME, luaopen_table},
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
- {LUA_MATHLIBNAME, luaopen_io},
- {LUA_MATHLIBNAME, luaopen_os},
- {LUA_MATHLIBNAME, luaopen_pipe},
+ {LUA_IOLIBNAME, luaopen_io},
+ {LUA_OSLIBNAME, luaopen_os},
+ {LUA_PIPELIBNAME, luaopen_pipe},
{NULL, NULL}
};
@@ -129,8 +129,8 @@ void* main_loop(void* file)
printf("%s returned with %d\n", (char*)file, ret);
lua_close(L);
-
- /* this should bring down the other thread as well
+
+ /* this should bring down the other thread as well
at least this is true for the tcp-server thread */
pipe_close();
@@ -140,7 +140,7 @@ void* main_loop(void* file)
int main(int argc, char* argv[])
{
printf("starting nopsyncd...\n");
-
+
pthread_t qlistener, tcpserver;
int ret = pipe_init();
@@ -158,7 +158,7 @@ int main(int argc, char* argv[])
ret = pthread_create(&tcpserver, NULL, main_loop, TCPSERVER);
if(ret) {
- fprintf(stderr, "Error creating qlistener thread (code: %d)\n", ret);
+ fprintf(stderr, "Error creating tcpserver thread (code: %d)\n", ret);
return 1;
}
diff --git a/rhnop-server/qlistener.lua b/rhnop-server/qlistener.lua
index cac6860..b41e2a7 100644
--- a/rhnop-server/qlistener.lua
+++ b/rhnop-server/qlistener.lua
@@ -33,6 +33,7 @@ function handle_now(timestamp, nowcart, nowlen)
local results, err = rddb:getCartInfo(nowcart);
if results == nil then
io.stderr:write("can't fetch cart info: " .. err .. "\n")
+-- TODO: this error shouldn't be ignored!!!!
else
-- print(timestamp .. " Info: '" .. results.TITLE .. "' von '" .. results.ARTIST .. "' aus '" .. results.ALBUM .. "'")
local ret, err = playlog:insertNowMusic(timestamp, nowcart, nowlen, results.TITLE, results.ARTIST, results.ALBUM)
@@ -69,14 +70,14 @@ function main_loop()
os.exit(1)
end
end
-
+
local ret, err = playlog:init()
if ret == nil then
io.stderr:write("creation of playlog failed: " .. err .. "\n")
os.exit(1)
end
last_cart = assert(playlog:getLastCart())
-
+
local ret, err = rddb:init()
if ret == nil then
io.stderr:write("opening rivendell db failed: " .. err .. "\n")