Software /
code /
prosody
Comparison
net/server.lua @ 2059:d4fb80b60c65
server.lua: Standardise on 'client' variable to refer to the socket, makes the code a bit cleaner
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 26 Oct 2009 23:35:48 +0000 |
parent | 2057:ee2929e620bb |
child | 2281:27441b099984 |
child | 2764:6f5c30865ddf |
comparison
equal
deleted
inserted
replaced
2058:77244fd4ca99 | 2059:d4fb80b60c65 |
---|---|
535 local wrote | 535 local wrote |
536 local read | 536 local read |
537 handshake = coroutine_wrap( function( client ) -- create handshake coroutine | 537 handshake = coroutine_wrap( function( client ) -- create handshake coroutine |
538 local err | 538 local err |
539 for i = 1, _maxsslhandshake do | 539 for i = 1, _maxsslhandshake do |
540 _sendlistlen = ( wrote and removesocket( _sendlist, socket, _sendlistlen ) ) or _sendlistlen | 540 _sendlistlen = ( wrote and removesocket( _sendlist, client, _sendlistlen ) ) or _sendlistlen |
541 _readlistlen = ( read and removesocket( _readlist, socket, _readlistlen ) ) or _readlistlen | 541 _readlistlen = ( read and removesocket( _readlist, client, _readlistlen ) ) or _readlistlen |
542 read, wrote = nil, nil | 542 read, wrote = nil, nil |
543 _, err = client:dohandshake( ) | 543 _, err = client:dohandshake( ) |
544 if not err then | 544 if not err then |
545 out_put( "server.lua: ssl handshake done" ) | 545 out_put( "server.lua: ssl handshake done" ) |
546 handler.readbuffer = _readbuffer -- when handshake is done, replace the handshake function with regular functions | 546 handler.readbuffer = _readbuffer -- when handshake is done, replace the handshake function with regular functions |
547 handler.sendbuffer = _sendbuffer | 547 handler.sendbuffer = _sendbuffer |
548 _ = status and status( handler, "ssl-handshake-complete" ) | 548 _ = status and status( handler, "ssl-handshake-complete" ) |
549 _readlistlen = addsocket(_readlist, socket, _readlistlen) | 549 _readlistlen = addsocket(_readlist, client, _readlistlen) |
550 return true | 550 return true |
551 else | 551 else |
552 out_put( "server.lua: error during ssl handshake: ", tostring(err) ) | 552 out_put( "server.lua: error during ssl handshake: ", tostring(err) ) |
553 if err == "wantwrite" and not wrote then | 553 if err == "wantwrite" and not wrote then |
554 _sendlistlen = addsocket(_sendlist, client, _sendlistlen) | 554 _sendlistlen = addsocket(_sendlist, client, _sendlistlen) |