Software /
code /
prosody
Comparison
net/server_event.lua @ 10547:c77471c180ea
net.server_event: Silence luacheck warnings
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 23 Dec 2019 21:52:28 +0100 |
parent | 10407:bd8fbee04a2f |
child | 11068:988ddd57e851 |
comparison
equal
deleted
inserted
replaced
10546:944863f878b9 | 10547:c77471c180ea |
---|---|
690 else | 690 else |
691 return EV_READ -- accept again | 691 return EV_READ -- accept again |
692 end | 692 end |
693 end | 693 end |
694 --vdebug("max connection check ok, accepting...") | 694 --vdebug("max connection check ok, accepting...") |
695 -- luacheck: ignore 231/err | |
695 local client, err = server:accept() -- try to accept; TODO: check err | 696 local client, err = server:accept() -- try to accept; TODO: check err |
696 while client do | 697 while client do |
697 if interface._connections >= cfg.MAX_CONNECTIONS then | 698 if interface._connections >= cfg.MAX_CONNECTIONS then |
698 client:close( ) -- refuse connection | 699 client:close( ) -- refuse connection |
699 debug( "maximal connections reached, refuse client connection; accept delay:", delay ) | 700 debug( "maximal connections reached, refuse client connection; accept delay:", delay ) |
778 return nil, err | 779 return nil, err |
779 end | 780 end |
780 client:settimeout( 0 ) -- set nonblocking | 781 client:settimeout( 0 ) -- set nonblocking |
781 local res, err = client:setpeername( addr, serverport ) -- connect | 782 local res, err = client:setpeername( addr, serverport ) -- connect |
782 if res or ( err == "timeout" ) then | 783 if res or ( err == "timeout" ) then |
784 -- luacheck: ignore 211/port | |
783 local ip, port = client:getsockname( ) | 785 local ip, port = client:getsockname( ) |
784 local interface = wrapclient( client, ip, serverport, listener, pattern, sslctx, extra ) | 786 local interface = wrapclient( client, ip, serverport, listener, pattern, sslctx, extra ) |
785 debug( "new connection id:", interface.id ) | 787 debug( "new connection id:", interface.id ) |
786 return interface, err | 788 return interface, err |
787 else | 789 else |