瀏覽代碼

close connection on sent instead on receive

devsaurus 8 年之前
父節點
當前提交
626e7d3c91
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lua_examples/webap_toggle_pin.lua

+ 1 - 1
lua_examples/webap_toggle_pin.lua

@@ -26,6 +26,6 @@ srv:listen(80,function(conn)
         end
         buf = buf.."<option".._on..">ON</opton><option".._off..">OFF</option></select></form>";
         client:send(buf);
-        client:close();
     end)
+    conn:on("sent", function (c) c:close() end)
 end)