コード例 #1
0
ファイル: TSocket.php プロジェクト: davidnasar/fbthrift
            $t_start = microtime(true);
            $got = fwrite($this->handle_, $buf);
            $write_time = microtime(true) - $t_start;
            if ($got === 0 || !\hacklib_cast_as_boolean(is_int($got))) {
                $read_err_detail = sprintf('%d bytes from %s:%d to localhost:%d. Spent %2.2f ms.', $buflen, $this->host_, $this->port_, $this->lport_, $write_time * 1000);
                $md = stream_get_meta_data($this->handle_);
                if (\hacklib_cast_as_boolean($md[\hacklib_id('timed_out')])) {
                    throw new TTransportException('TSocket: timeout while writing ' . $read_err_detail, TTransportException::TIMED_OUT);
                } else {
                    $md_str = str_replace("\n", " ", print_r($md, true));
                    throw new TTransportException('TSocket: could not write ' . $read_err_detail, TTransportException::COULD_NOT_WRITE);
                }
            }
            $buf = substr($buf, $got);
        }
        $this->writeAttemptStart_ = null;
    }
    public function flush()
    {
        $ret = fflush($this->handle_);
        if ($ret === false) {
            throw new TTransportException('TSocket: could not flush ' . $this->host_ . ':' . $this->port_);
        }
    }
    public static function hacklib_initialize_statics()
    {
        self::hacklib_initialize_statics_InstrumentedTTransportTrait();
    }
}
TSocket::hacklib_initialize_statics();