From d336a3ea9e581372e225ee64113fe7fd7e080d45 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 14 Feb 2015 13:55:54 +0100 Subject: Fixed TCP link shutdown. The shutdown is postponed until there's no more outgoing data in the LibEvent buffers. --- MCServer/Plugins/NetworkTest/NetworkTest.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'MCServer') diff --git a/MCServer/Plugins/NetworkTest/NetworkTest.lua b/MCServer/Plugins/NetworkTest/NetworkTest.lua index 251e29884..39774f403 100644 --- a/MCServer/Plugins/NetworkTest/NetworkTest.lua +++ b/MCServer/Plugins/NetworkTest/NetworkTest.lua @@ -163,14 +163,15 @@ local g_Services = OnReceivedData = function (a_Link, a_Data) IncomingData = IncomingData .. a_Data if (IncomingData:find("\r\n\r\n")) then + -- We have received the entire request headers, just send the response and shutdown the link: local Content = os.date() a_Link:Send("HTTP/1.0 200 OK\r\nContent-type: text/plain\r\nContent-length: " .. #Content .. "\r\n\r\n" .. Content) - -- TODO: shutdown is not yet properly implemented in cTCPLink - -- a_Link:Shutdown() + a_Link:Shutdown() end end, OnRemoteClosed = function (a_Link) + LOG("httpstime: link closed by remote") end } -- Link callbacks end, -- OnIncomingConnection() -- cgit v1.2.3