Software /
code /
prosody
Comparison
net/server_event.lua @ 2121:3a5ed91a9f27
net.server_event: Use conn property for send/receive instead of caching, fixes trying to use original socket after SSL-wrapping
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 22 Nov 2009 03:58:37 +0000 |
parent | 2120:93eae69fc121 |
child | 2122:dd1da05568e4 |
comparison
equal
deleted
inserted
replaced
2120:93eae69fc121 | 2121:3a5ed91a9f27 |
---|---|
471 if interface.eventwritetimeout then -- luasec only | 471 if interface.eventwritetimeout then -- luasec only |
472 interface.eventwritetimeout:close( ) -- first we have to close timeout event which where regged after a wantread error | 472 interface.eventwritetimeout:close( ) -- first we have to close timeout event which where regged after a wantread error |
473 interface.eventwritetimeout = false | 473 interface.eventwritetimeout = false |
474 end | 474 end |
475 end | 475 end |
476 local succ, err, byte = interface.send( interface.conn, interface.writebuffer, 1, interface.writebufferlen ) | 476 local succ, err, byte = interface.conn:send( interface.writebuffer, 1, interface.writebufferlen ) |
477 --vdebug( "write data:", interface.writebuffer, "error:", err, "part:", byte ) | 477 --vdebug( "write data:", interface.writebuffer, "error:", err, "part:", byte ) |
478 if succ then -- writing succesful | 478 if succ then -- writing succesful |
479 interface.writebuffer = "" | 479 interface.writebuffer = "" |
480 interface.writebufferlen = 0 | 480 interface.writebufferlen = 0 |
481 if interface.fatalerror then | 481 if interface.fatalerror then |
537 if interface.eventreadtimeout then | 537 if interface.eventreadtimeout then |
538 interface.eventreadtimeout:close( ) | 538 interface.eventreadtimeout:close( ) |
539 interface.eventreadtimeout = nil | 539 interface.eventreadtimeout = nil |
540 end | 540 end |
541 end | 541 end |
542 local buffer, err, part = receive( client, pattern ) -- receive buffer with "pattern" | |
543 --vdebug( "read data:", buffer, "error:", err, "part:", part ) | 542 --vdebug( "read data:", buffer, "error:", err, "part:", part ) |
543 local buffer, err, part = interface.conn:receive( pattern ) -- receive buffer with "pattern" | |
544 buffer = buffer or part or "" | 544 buffer = buffer or part or "" |
545 local len = string_len( buffer ) | 545 local len = string_len( buffer ) |
546 if len > cfg.MAX_READ_LENGTH then -- check buffer length | 546 if len > cfg.MAX_READ_LENGTH then -- check buffer length |
547 interface.fatalerror = "receive buffer exceeded" | 547 interface.fatalerror = "receive buffer exceeded" |
548 debug( "fatal error:", interface.fatalerror ) | 548 debug( "fatal error:", interface.fatalerror ) |