Software /
code /
prosody
Comparison
net/server_event.lua @ 3001:fa00c6f563b4
net.server_select, net.server_event: Rename :pattern() method to :set_mode() for select backend, and add :set_mode() to event backend
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 May 2010 15:23:17 +0100 |
parent | 3000:43a4cb707fe4 |
child | 3002:d1f864ed44c0 |
comparison
equal
deleted
inserted
replaced
3000:43a4cb707fe4 | 3001:fa00c6f563b4 |
---|---|
400 self.starttls = nil; -- use starttls() of interface_mt | 400 self.starttls = nil; -- use starttls() of interface_mt |
401 else | 401 else |
402 self.starttls = false; -- prevent starttls() | 402 self.starttls = false; -- prevent starttls() |
403 end | 403 end |
404 end | 404 end |
405 | |
406 function interface_mt:set_mode(pattern) | |
407 if pattern then | |
408 self._pattern = pattern; | |
409 end | |
410 return self._pattern; | |
411 end | |
405 | 412 |
406 function interface_mt:set_send(new_send) | 413 function interface_mt:set_send(new_send) |
407 -- No-op, we always use the underlying connection's send | 414 -- No-op, we always use the underlying connection's send |
408 end | 415 end |
409 | 416 |
597 if interface.eventreadtimeout then | 604 if interface.eventreadtimeout then |
598 interface.eventreadtimeout:close( ) | 605 interface.eventreadtimeout:close( ) |
599 interface.eventreadtimeout = nil | 606 interface.eventreadtimeout = nil |
600 end | 607 end |
601 end | 608 end |
602 local buffer, err, part = interface.conn:receive( pattern ) -- receive buffer with "pattern" | 609 local buffer, err, part = interface.conn:receive( interface._pattern ) -- receive buffer with "pattern" |
603 --vdebug( "read data:", tostring(buffer), "error:", tostring(err), "part:", tostring(part) ) | 610 --vdebug( "read data:", tostring(buffer), "error:", tostring(err), "part:", tostring(part) ) |
604 buffer = buffer or part or "" | 611 buffer = buffer or part or "" |
605 local len = string_len( buffer ) | 612 local len = string_len( buffer ) |
606 if len > cfg.MAX_READ_LENGTH then -- check buffer length | 613 if len > cfg.MAX_READ_LENGTH then -- check buffer length |
607 interface.fatalerror = "receive buffer exceeded" | 614 interface.fatalerror = "receive buffer exceeded" |