Software /
code /
prosody
Comparison
net/server_select.lua @ 2109:0dc5eb9dbb62
net.server_select: Change addserver() parameters to be compatible with new standard syntax
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 17:19:57 +0000 |
parent | 2093:abfa1cc3a42f |
child | 2131:72411e239221 |
comparison
equal
deleted
inserted
replaced
2108:6425bc039430 | 2109:0dc5eb9dbb62 |
---|---|
690 --mem_free( ) | 690 --mem_free( ) |
691 end | 691 end |
692 | 692 |
693 ----------------------------------// PUBLIC //-- | 693 ----------------------------------// PUBLIC //-- |
694 | 694 |
695 addserver = function( listeners, port, addr, pattern, sslctx, maxconnections, startssl ) -- this function provides a way for other scripts to reg a server | 695 addserver = function( addr, port, listeners, pattern, sslctx, startssl ) -- this function provides a way for other scripts to reg a server |
696 local err | 696 local err |
697 --out_put("server.lua: autossl on ", port, " is ", startssl) | 697 --out_put("server.lua: autossl on ", port, " is ", startssl) |
698 if type( listeners ) ~= "table" then | 698 if type( listeners ) ~= "table" then |
699 err = "invalid listener table" | 699 err = "invalid listener table" |
700 end | 700 end |
713 local server, err = socket_bind( addr, port ) | 713 local server, err = socket_bind( addr, port ) |
714 if err then | 714 if err then |
715 out_error( "server.lua, port ", port, ": ", err ) | 715 out_error( "server.lua, port ", port, ": ", err ) |
716 return nil, err | 716 return nil, err |
717 end | 717 end |
718 local handler, err = wrapserver( listeners, server, addr, port, pattern, sslctx, maxconnections, startssl ) -- wrap new server socket | 718 local handler, err = wrapserver( listeners, server, addr, port, pattern, sslctx, _maxclientsperserver, startssl ) -- wrap new server socket |
719 if not handler then | 719 if not handler then |
720 server:close( ) | 720 server:close( ) |
721 return nil, err | 721 return nil, err |
722 end | 722 end |
723 server:settimeout( 0 ) | 723 server:settimeout( 0 ) |