Software /
code /
prosody
Comparison
net/server_select.lua @ 2597:40a174e8cdf6
net.server_select: Fix traceback with no LuaSec available (thanks Nolan)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 11 Feb 2010 21:09:59 +0000 |
parent | 2582:d6afb6d919df |
child | 2598:8a021b304765 |
comparison
equal
deleted
inserted
replaced
2596:187cd90860cb | 2597:40a174e8cdf6 |
---|---|
53 local coroutine_wrap = coroutine.wrap | 53 local coroutine_wrap = coroutine.wrap |
54 local coroutine_yield = coroutine.yield | 54 local coroutine_yield = coroutine.yield |
55 | 55 |
56 --// extern libs //-- | 56 --// extern libs //-- |
57 | 57 |
58 local luasec = select( 2, pcall( require, "ssl" ) ) | 58 local luasec = use "ssl" |
59 local luasocket = require "socket" | 59 local luasocket = use "socket" or require "socket" |
60 | 60 |
61 --// extern lib methods //-- | 61 --// extern lib methods //-- |
62 | 62 |
63 local ssl_wrap = ( luasec and luasec.wrap ) | 63 local ssl_wrap = ( luasec and luasec.wrap ) |
64 local socket_bind = luasocket.bind | 64 local socket_bind = luasocket.bind |
599 handshake( socket ) -- do handshake | 599 handshake( socket ) -- do handshake |
600 end | 600 end |
601 handler.readbuffer = _readbuffer | 601 handler.readbuffer = _readbuffer |
602 handler.sendbuffer = _sendbuffer | 602 handler.sendbuffer = _sendbuffer |
603 end | 603 end |
604 end | 604 else |
605 | 605 handler.readbuffer = _readbuffer |
606 handler.sendbuffer = _sendbuffer | |
607 end | |
606 send = socket.send | 608 send = socket.send |
607 receive = socket.receive | 609 receive = socket.receive |
608 shutdown = ( ssl and id ) or socket.shutdown | 610 shutdown = ( ssl and id ) or socket.shutdown |
609 | 611 |
610 _socketlist[ socket ] = handler | 612 _socketlist[ socket ] = handler |