memcached.lua

changeset 2
c5215e30b6ef
parent 1
1ec09b2f61c3
child 3
aebc17f0d002
equal deleted inserted replaced
1:1ec09b2f61c3 2:c5215e30b6ef
15 function memcached_listener.onincoming(conn, line) 15 function memcached_listener.onincoming(conn, line)
16 local command, params_pos = line:match("^(%S+) ?()"); 16 local command, params_pos = line:match("^(%S+) ?()");
17 local command_handler = command_handlers[command]; 17 local command_handler = command_handlers[command];
18 if command_handler then 18 if command_handler then
19 local ok, err = command_handler(conn, line:sub(params_pos)); 19 local ok, err = command_handler(conn, line:sub(params_pos));
20 if not ok then 20 if ok == false then
21 conn:write("CLIENT_ERROR "..err.."\r\n"); 21 conn:write("CLIENT_ERROR "..err.."\r\n");
22 end 22 end
23 elseif command then 23 elseif command then
24 log("warn", "Client sent unknown command: %s", command); 24 log("warn", "Client sent unknown command: %s", command);
25 conn:write("ERROR\r\n"); 25 conn:write("ERROR\r\n");

mercurial