Software /
code /
prosody
Comparison
net/server.lua @ 1545:e6bd29342f65
Merge with 0.5
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 12 Jul 2009 20:33:09 +0100 |
parent | 1544:c7f0938bc33e |
child | 1546:7d7bf705675d |
comparison
equal
deleted
inserted
replaced
1542:e5d5f864c125 | 1545:e6bd29342f65 |
---|---|
1 -- Prosody IM | |
2 -- Copyright (C) 2008-2009 Matthew Wild | |
3 -- Copyright (C) 2008-2009 Waqas Hussain | |
4 -- | 1 -- |
5 -- This project is MIT/X11 licensed. Please see the | 2 -- server.lua by blastbeat of the luadch project |
6 -- COPYING file in the source package for more information. | 3 -- Re-used here under the MIT/X Consortium License |
4 -- | |
5 -- Modifications (C) 2008-2009 Matthew Wild, Waqas Hussain | |
7 -- | 6 -- |
8 | |
9 --[[ | |
10 | |
11 server.lua by blastbeat | |
12 | |
13 - this script contains the server loop of the program | |
14 - other scripts can reg a server here | |
15 | |
16 ]]-- | |
17 | 7 |
18 -- // wrapping luadch stuff // -- | 8 -- // wrapping luadch stuff // -- |
19 | 9 |
20 local use = function( what ) | 10 local use = function( what ) |
21 return _G[ what ] | 11 return _G[ what ] |
544 return nil, nil, err -- fatal error | 534 return nil, nil, err -- fatal error |
545 end | 535 end |
546 socket:settimeout( 0 ) | 536 socket:settimeout( 0 ) |
547 handler.readbuffer = handshake | 537 handler.readbuffer = handshake |
548 handler.sendbuffer = handshake | 538 handler.sendbuffer = handshake |
549 if not handshake( socket ) then -- do handshake | 539 if not socket then -- do handshake |
550 return nil, nil, "ssl handshake failed"; | 540 return nil, nil, "ssl handshake failed"; |
551 end | 541 end |
552 else | 542 else |
553 -- We're not automatically doing SSL, so we're not secure (yet) | 543 -- We're not automatically doing SSL, so we're not secure (yet) |
554 ssl = false | 544 ssl = false |