Software /
code /
prosody
Comparison
net/server.lua @ 567:ae7f6167d780
Re-commit TLS fix
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 05 Dec 2008 19:55:46 +0000 |
parent | 566:c83166927835 |
child | 581:23b9cd1206ba |
comparison
equal
deleted
inserted
replaced
566:c83166927835 | 567:ae7f6167d780 |
---|---|
499 local wrote, read | 499 local wrote, read |
500 | 500 |
501 handler.starttls = function (now) | 501 handler.starttls = function (now) |
502 if not now then out_put("server.lua: we need to do tls, but delaying until later"); handler.need_tls = true; return; end | 502 if not now then out_put("server.lua: we need to do tls, but delaying until later"); handler.need_tls = true; return; end |
503 out_put( "server.lua: attempting to start tls on "..tostring(socket) ) | 503 out_put( "server.lua: attempting to start tls on "..tostring(socket) ) |
504 local oldsocket = socket; | |
504 socket, err = ssl_wrap( socket, sslctx ) -- wrap socket | 505 socket, err = ssl_wrap( socket, sslctx ) -- wrap socket |
505 out_put("sslwrapped socket is "..tostring(socket)); | 506 out_put("sslwrapped socket is "..tostring(socket)); |
506 if err then | 507 if err then |
507 out_put( "server.lua: ssl error: ", err ) | 508 out_put( "server.lua: ssl error: ", err ) |
508 return nil, nil, err -- fatal error | 509 return nil, nil, err -- fatal error |
509 end | 510 end |
510 socket:settimeout( 1 ) | 511 socket:settimeout(0); |
512 | |
513 -- Add the new socket to our system | |
514 socketlist[ socket ] = handler | |
515 readlen = readlen + 1 | |
516 readlist[ readlen ] = socket | |
517 | |
518 -- Remove traces of the old socket | |
519 readlen = removesocket( readlist, oldsocket, readlen ) | |
520 socketlist [ oldsocket ] = nil; | |
521 | |
511 send = socket.send | 522 send = socket.send |
512 receive = socket.receive | 523 receive = socket.receive |
513 close = socket.close | 524 close = socket.close |
514 handler.ssl = function( ) | 525 handler.ssl = function( ) |
515 return true | 526 return true |