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"); |