Software /
code /
prosody
Comparison
net/server_select.lua @ 4429:8e02ba75ef06
net.server_select: Autostart SSL negotiation as the last part of socket setup to avoid a traceback (#262) (thanks Maranda)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 28 Nov 2011 03:04:50 +0000 |
parent | 4399:1b4161970842 |
child | 4675:80f2d952d4c5 |
comparison
equal
deleted
inserted
replaced
4428:0317b01b6bcd | 4429:8e02ba75ef06 |
---|---|
594 | 594 |
595 handler.readbuffer = handshake | 595 handler.readbuffer = handshake |
596 handler.sendbuffer = handshake | 596 handler.sendbuffer = handshake |
597 handshake( socket ) -- do handshake | 597 handshake( socket ) -- do handshake |
598 end | 598 end |
599 handler.readbuffer = _readbuffer | 599 end |
600 handler.sendbuffer = _sendbuffer | 600 |
601 | 601 handler.readbuffer = _readbuffer |
602 if sslctx then | 602 handler.sendbuffer = _sendbuffer |
603 out_put "server.lua: auto-starting ssl negotiation..." | |
604 handler.autostart_ssl = true; | |
605 handler:starttls(sslctx); | |
606 end | |
607 | |
608 else | |
609 handler.readbuffer = _readbuffer | |
610 handler.sendbuffer = _sendbuffer | |
611 end | |
612 send = socket.send | 603 send = socket.send |
613 receive = socket.receive | 604 receive = socket.receive |
614 shutdown = ( ssl and id ) or socket.shutdown | 605 shutdown = ( ssl and id ) or socket.shutdown |
615 | 606 |
616 _socketlist[ socket ] = handler | 607 _socketlist[ socket ] = handler |
617 _readlistlen = addsocket(_readlist, socket, _readlistlen) | 608 _readlistlen = addsocket(_readlist, socket, _readlistlen) |
609 | |
610 if sslctx and luasec then | |
611 out_put "server.lua: auto-starting ssl negotiation..." | |
612 handler.autostart_ssl = true; | |
613 handler:starttls(sslctx); | |
614 end | |
615 | |
618 return handler, socket | 616 return handler, socket |
619 end | 617 end |
620 | 618 |
621 id = function( ) | 619 id = function( ) |
622 end | 620 end |