Parcourir la source

For lua, let mg.read() read only if the data is there.

Sergey Lyubka il y a 12 ans
Parent
commit
49d9016275
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      mod_lua.c

+ 1 - 1
mod_lua.c

@@ -208,7 +208,7 @@ static int lsp_read(lua_State *L) {
   char buf[1024];
   char buf[1024];
   int len = mg_read(conn, buf, sizeof(buf));
   int len = mg_read(conn, buf, sizeof(buf));
 
 
-  if (!len) return 0;
+  if (len <= 0) return 0;
   lua_pushlstring(L, buf, len);
   lua_pushlstring(L, buf, len);
 
 
   return 1;
   return 1;