Comparison

net/server_select.lua @ 4347:4b5290dd4e58

net.server_select: Small fix to SSL handshake logic, read/wrote were being checked despite it not being possible for them to be other than nil
author Matthew Wild <mwild1@gmail.com>
date Sat, 20 Aug 2011 15:03:16 -0400
parent 4346:28b9384c14fd
child 4348:5b240c6b5334
comparison
equal deleted inserted replaced
4346:28b9384c14fd 4347:4b5290dd4e58
510 510
511 -- Set the sslctx 511 -- Set the sslctx
512 local handshake; 512 local handshake;
513 function handler.set_sslctx(self, new_sslctx) 513 function handler.set_sslctx(self, new_sslctx)
514 sslctx = new_sslctx; 514 sslctx = new_sslctx;
515 local wrote 515 local read, wrote
516 local read
517 handshake = coroutine_wrap( function( client ) -- create handshake coroutine 516 handshake = coroutine_wrap( function( client ) -- create handshake coroutine
518 local err 517 local err
519 for i = 1, _maxsslhandshake do 518 for i = 1, _maxsslhandshake do
520 _sendlistlen = ( wrote and removesocket( _sendlist, client, _sendlistlen ) ) or _sendlistlen 519 _sendlistlen = ( wrote and removesocket( _sendlist, client, _sendlistlen ) ) or _sendlistlen
521 _readlistlen = ( read and removesocket( _readlist, client, _readlistlen ) ) or _readlistlen 520 _readlistlen = ( read and removesocket( _readlist, client, _readlistlen ) ) or _readlistlen
527 handler.sendbuffer = _sendbuffer 526 handler.sendbuffer = _sendbuffer
528 _ = status and status( handler, "ssl-handshake-complete" ) 527 _ = status and status( handler, "ssl-handshake-complete" )
529 _readlistlen = addsocket(_readlist, client, _readlistlen) 528 _readlistlen = addsocket(_readlist, client, _readlistlen)
530 return true 529 return true
531 else 530 else
532 if err == "wantwrite" and not wrote then 531 if err == "wantwrite" then
533 _sendlistlen = addsocket(_sendlist, client, _sendlistlen) 532 _sendlistlen = addsocket(_sendlist, client, _sendlistlen)
534 wrote = true 533 wrote = true
535 elseif err == "wantread" and not read then 534 elseif err == "wantread" then
536 _readlistlen = addsocket(_readlist, client, _readlistlen) 535 _readlistlen = addsocket(_readlist, client, _readlistlen)
537 read = true 536 read = true
538 else 537 else
539 out_put( "server.lua: ssl handshake error: ", tostring(err) ) 538 out_put( "server.lua: ssl handshake error: ", tostring(err) )
540 break; 539 break;