public function flush()
 {
     if (TStringFuncFactory::create()->strlen($this->wBuf_) > 0) {
         $this->transport_->write($this->wBuf_);
         $this->wBuf_ = '';
     }
     $this->transport_->flush();
 }
 private function saslWrite_($payload, $status = null)
 {
     $header = '';
     if (null !== $status) {
         $header .= pack('C', $status);
     }
     $header .= pack('N', TStringFuncFactory::create()->strlen($payload));
     $this->transport_->write($header . $payload);
     $this->transport_->flush();
 }
 public function flush()
 {
     if (TStringFuncFactory::create()->strlen($this->wBuf_) > 0) {
         $out = $this->wBuf_;
         // Note that we clear the internal wBuf_ prior to the underlying write
         // to ensure we're in a sane state (i.e. internal buffer cleaned)
         // if the underlying write throws up an exception
         $this->wBuf_ = '';
         $this->transport_->write($out);
     }
     $this->transport_->flush();
 }
Esempio n. 4
0
 /**
  * Writes the output buffer to the stream in the format of a 4-byte length
  * followed by the actual data.
  */
 public function flush()
 {
     if (!$this->write_ || TStringFuncFactory::create()->strlen($this->wBuf_) == 0) {
         return $this->transport_->flush();
     }
     if ($contextBuf = $this->writeContextSerialize()) {
         $this->wBuf_ = $contextBuf . $this->wBuf_;
     }
     // Note that we clear the internal wBuf_ prior to the underlying write
     // to ensure we're in a sane state (i.e. internal buffer cleaned)
     // if the underlying write throws up an exception
     $this->transport_->write(pack('N', TStringFuncFactory::create()->strlen($this->wBuf_)) . $this->wBuf_);
     $this->wBuf_ = '';
     $this->transport_->flush();
 }