Преглед изворни кода

Support USE_LUA without USE_WEBSOCKET

bel пре 11 година
родитељ
комит
1ef67f5cc7
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      src/mod_lua.inl

+ 4 - 0
src/mod_lua.inl

@@ -280,6 +280,7 @@ static int lsp_redirect(lua_State *L)
 
 
 static int lwebsock_write(lua_State *L)
 static int lwebsock_write(lua_State *L)
 {
 {
+#ifdef USE_WEBSOCKET
     int num_args = lua_gettop(L);
     int num_args = lua_gettop(L);
     struct mg_connection *conn = lua_touserdata(L, lua_upvalueindex(1));
     struct mg_connection *conn = lua_touserdata(L, lua_upvalueindex(1));
     const char *str;
     const char *str;
@@ -308,6 +309,7 @@ static int lwebsock_write(lua_State *L)
             mg_websocket_write(conn, WEBSOCKET_OPCODE_TEXT, str, size);
             mg_websocket_write(conn, WEBSOCKET_OPCODE_TEXT, str, size);
         }
         }
     }
     }
+#endif    
     return 0;
     return 0;
 }
 }
 
 
@@ -575,6 +577,7 @@ static void * new_lua_websocket(const char * script, struct mg_connection *conn)
     return L;
     return L;
 }
 }
 
 
+#ifdef USE_WEBSOCKET
 static void lua_websocket_ready(struct mg_connection *conn)
 static void lua_websocket_ready(struct mg_connection *conn)
 {
 {
     lua_State *L = (lua_State*)(conn->lua_websocket_state);
     lua_State *L = (lua_State*)(conn->lua_websocket_state);
@@ -621,3 +624,4 @@ static void lua_websocket_close(struct mg_connection *conn)
     lua_close(L);
     lua_close(L);
     conn->lua_websocket_state = NULL;
     conn->lua_websocket_state = NULL;
 }
 }
+#endif