Comparison

net/server_event.lua @ 2731:373a7c960409

net.server_event: Fix some global accesses
author Matthew Wild <mwild1@gmail.com>
date Mon, 01 Mar 2010 18:46:37 +0000
parent 2726:1b9179e04233
child 2939:dc73cbc69bd5
comparison
equal deleted inserted replaced
2729:7e0c35713bf5 2731:373a7c960409
541 interface.writebufferlen = interface.writebufferlen - byte 541 interface.writebufferlen = interface.writebufferlen - byte
542 if "wantread" == err then -- happens only with luasec 542 if "wantread" == err then -- happens only with luasec
543 local callback = function( ) 543 local callback = function( )
544 interface:_close() 544 interface:_close()
545 interface.eventwritetimeout = nil 545 interface.eventwritetimeout = nil
546 return evreturn, evtimeout 546 return -1;
547 end 547 end
548 interface.eventwritetimeout = addevent( base, nil, EV_TIMEOUT, callback, cfg.WRITE_TIMEOUT ) -- reg a new timeout event 548 interface.eventwritetimeout = addevent( base, nil, EV_TIMEOUT, callback, cfg.WRITE_TIMEOUT ) -- reg a new timeout event
549 debug( "wantread during write attemp, reg it in readcallback but dont know what really happens next..." ) 549 debug( "wantread during write attemp, reg it in readcallback but dont know what really happens next..." )
550 -- hopefully this works with luasec; its simply not possible to use 2 different write events on a socket in luaevent 550 -- hopefully this works with luasec; its simply not possible to use 2 different write events on a socket in luaevent
551 return -1 551 return -1
760 if res or ( err == "timeout" ) then 760 if res or ( err == "timeout" ) then
761 local ip, port = client:getsockname( ) 761 local ip, port = client:getsockname( )
762 local server = function( ) 762 local server = function( )
763 return nil, "this is a dummy server interface" 763 return nil, "this is a dummy server interface"
764 end 764 end
765 local interface = wrapclient( client, ip, serverport, listeners, pattern, sslctx, startssl ) 765 local interface = wrapclient( client, ip, serverport, listener, pattern, sslctx, startssl )
766 interface:_start_connection( startssl ) 766 interface:_start_connection( startssl )
767 debug( "new connection id:", interface.id ) 767 debug( "new connection id:", interface.id )
768 return interface, err 768 return interface, err
769 else 769 else
770 debug( "new connection failed:", err ) 770 debug( "new connection failed:", err )