Software /
code /
prosody
Changeset
2603:3a77cc94b85c
Merge with trunk.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 12 Feb 2010 02:50:57 +0500 |
parents | 2602:dff84fdebac0 (current diff) 2599:cc6164d85024 (diff) |
children | 2604:ed32f7bad620 |
files | |
diffstat | 2 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_event.lua Fri Feb 12 02:43:02 2010 +0500 +++ b/net/server_event.lua Fri Feb 12 02:50:57 2010 +0500 @@ -43,7 +43,7 @@ local coroutine = use "coroutine" local setmetatable = use "setmetatable" -local ssl = use "ssl" or require "ssl" +local ssl = use "ssl" local socket = use "socket" or require "socket" local log = require ("util.logger").init("socket") @@ -142,7 +142,7 @@ self:_close() debug( "new connection failed. id:", self.id, "error:", self.fatalerror ) else - if plainssl then -- start ssl session + if plainssl and ssl then -- start ssl session self:starttls() else -- normal connection self:_start_session( self.listener.onconnect ) @@ -489,6 +489,7 @@ _sslctx = sslctx; -- parameters _usingssl = false; -- client is using ssl; } + if not ssl then interface.starttls = false; end interface.id = tostring(interface):match("%x+$"); interface.writecallback = function( event ) -- called on write events --vdebug( "new client write event, id/ip/port:", interface, ip, port ) @@ -670,7 +671,7 @@ interface._connections = interface._connections + 1 -- increase connection count local clientinterface = handleclient( client, ip, port, interface, pattern, listener, nil, sslctx ) --vdebug( "client id:", clientinterface, "startssl:", startssl ) - if sslctx then + if ssl and sslctx then clientinterface:starttls(sslctx) else clientinterface:_start_session( clientinterface.onconnect )
--- a/net/server_select.lua Fri Feb 12 02:43:02 2010 +0500 +++ b/net/server_select.lua Fri Feb 12 02:50:57 2010 +0500 @@ -55,8 +55,8 @@ --// extern libs //-- -local luasec = select( 2, pcall( require, "ssl" ) ) -local luasocket = require "socket" +local luasec = use "ssl" +local luasocket = use "socket" or require "socket" --// extern lib methods //-- @@ -472,7 +472,7 @@ _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) -- delete socket from writelist _ = needtls and handler:starttls(nil, true) _writetimes[ handler ] = nil - _ = toclose and handler.close( ) + _ = toclose and handler.close( ) return true elseif byte and ( err == "timeout" or err == "wantwrite" ) then -- want write buffer = string_sub( buffer, byte + 1, bufferlen ) -- new buffer @@ -601,8 +601,10 @@ handler.readbuffer = _readbuffer handler.sendbuffer = _sendbuffer end + else + handler.readbuffer = _readbuffer + handler.sendbuffer = _sendbuffer end - send = socket.send receive = socket.receive shutdown = ( ssl and id ) or socket.shutdown