Changeset

5951:09645f58c14c

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Mon, 16 Dec 2013 23:32:29 +0000
parents 5947:49fb5835965e (current diff) 5950:bd1d1c29a7e7 (diff)
children 5955:b3d5aa57c454
files
diffstat 2 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/net/http.lua	Mon Dec 16 02:05:16 2013 +0000
+++ b/net/http.lua	Mon Dec 16 23:32:29 2013 +0000
@@ -20,6 +20,7 @@
 local pairs = pairs;
 local tonumber, tostring, xpcall, select, traceback =
       tonumber, tostring, xpcall, select, debug.traceback;
+local assert, error = assert, error
 
 local log = require "util.logger".init("http");
 
@@ -173,7 +174,7 @@
 		sslctx = ex and ex.sslctx or { mode = "client", protocol = "sslv23", options = { "no_sslv2" } };
 	end
 
-	req.handler, req.conn = server.wrapclient(conn, host, port_number, listener, "*a", sslctx);
+	req.handler, req.conn = assert(server.wrapclient(conn, host, port_number, listener, "*a", sslctx));
 	req.write = function (...) return req.handler:write(...); end
 
 	req.callback = function (content, code, request, response) log("debug", "Calling callback, status %s", code or "---"); return select(2, xpcall(function () return callback(content, code, request, response) end, handleerr)); end
--- a/net/server_select.lua	Mon Dec 16 02:05:16 2013 +0000
+++ b/net/server_select.lua	Mon Dec 16 23:32:29 2013 +0000
@@ -920,13 +920,9 @@
 			-- When socket is writeable, call onconnect
 			local _sendbuffer = handler.sendbuffer;
 			handler.sendbuffer = function ()
-				_sendlistlen = removesocket( _sendlist, socket, _sendlistlen );
 				handler.sendbuffer = _sendbuffer;
 				listeners.onconnect(handler);
-				-- If there was data with the incoming packet, handle it now.
-				if #handler:bufferqueue() > 0 then
-					return _sendbuffer();
-				end
+				return _sendbuffer(); -- Send any queued outgoing data
 			end
 		end
 	end