Software /
code /
prosody
Comparison
net/server.lua @ 850:edbd0d1fce93
net.server: Don't retry if client closes socket during SSL handshaking
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 01 Mar 2009 23:33:41 +0000 |
parent | 846:77244ba297ac |
child | 855:57057f2cbecb |
comparison
equal
deleted
inserted
replaced
849:5049b4512df0 | 850:edbd0d1fce93 |
---|---|
487 _sendlistlen = ( wrote and removesocket( _sendlist, socket, _sendlistlen ) ) or _sendlistlen | 487 _sendlistlen = ( wrote and removesocket( _sendlist, socket, _sendlistlen ) ) or _sendlistlen |
488 _readlistlen = ( read and removesocket( _readlist, socket, _readlistlen ) ) or _readlistlen | 488 _readlistlen = ( read and removesocket( _readlist, socket, _readlistlen ) ) or _readlistlen |
489 read, wrote = nil, nil | 489 read, wrote = nil, nil |
490 _, err = client:dohandshake( ) | 490 _, err = client:dohandshake( ) |
491 if not err then | 491 if not err then |
492 --out_put( "server.lua: ssl handshake done" ) | 492 out_put( "server.lua: ssl handshake done" ) |
493 handler.readbuffer = _readbuffer -- when handshake is done, replace the handshake function with regular functions | 493 handler.readbuffer = _readbuffer -- when handshake is done, replace the handshake function with regular functions |
494 handler.sendbuffer = _sendbuffer | 494 handler.sendbuffer = _sendbuffer |
495 -- return dispatch( handler ) | 495 -- return dispatch( handler ) |
496 return true | 496 return true |
497 else | 497 else |
502 wrote = true | 502 wrote = true |
503 elseif err == "wantread" and not read then | 503 elseif err == "wantread" and not read then |
504 _readlistlen = _readlistlen + 1 | 504 _readlistlen = _readlistlen + 1 |
505 _readlist [ _readlistlen ] = client | 505 _readlist [ _readlistlen ] = client |
506 read = true | 506 read = true |
507 else | |
508 break; | |
507 end | 509 end |
508 --coroutine_yield( handler, nil, err ) -- handshake not finished | 510 --coroutine_yield( handler, nil, err ) -- handshake not finished |
509 coroutine_yield( ) | 511 coroutine_yield( ) |
510 end | 512 end |
511 end | 513 end |
512 disconnect( handler, "max handshake attemps exceeded" ) | 514 disconnect( handler, "ssl handshake failed" ) |
513 handler.close( true ) -- forced disconnect | 515 handler.close( true ) -- forced disconnect |
514 return false -- handshake failed | 516 return false -- handshake failed |
515 end | 517 end |
516 ) | 518 ) |
517 if startssl then -- ssl now? | 519 if startssl then -- ssl now? |