@@ 457-472 (lines=16) @@ | ||
454 | * @param string Data to send |
|
455 | * @return boolean Success |
|
456 | */ |
|
457 | public function writeln($data) { |
|
458 | if (!$this->alive) { |
|
459 | Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')'); |
|
460 | return false; |
|
461 | } |
|
462 | if (!isset($this->bevWrite)) { |
|
463 | return false; |
|
464 | } |
|
465 | if (!strlen($data) && !strlen($this->EOL)) { |
|
466 | return true; |
|
467 | } |
|
468 | $this->writing = true; |
|
469 | $this->bevWrite->write($data); |
|
470 | $this->bevWrite->write($this->EOL); |
|
471 | return true; |
|
472 | } |
|
473 | ||
474 | /** |
|
475 | * Sets callback which will be called once when got EOF |
@@ 637-652 (lines=16) @@ | ||
634 | * @param string $data Data to send |
|
635 | * @return boolean Success |
|
636 | */ |
|
637 | public function writeln($data) { |
|
638 | if (!$this->alive) { |
|
639 | Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')'); |
|
640 | return false; |
|
641 | } |
|
642 | if (!isset($this->bev)) { |
|
643 | return false; |
|
644 | } |
|
645 | if (!strlen($data) && !strlen($this->EOL)) { |
|
646 | return true; |
|
647 | } |
|
648 | $this->writing = true; |
|
649 | $this->bev->write($data); |
|
650 | $this->bev->write($this->EOL); |
|
651 | return true; |
|
652 | } |
|
653 | ||
654 | /** |
|
655 | * Finish the session. You should not worry about buffers, they are going to be flushed properly |