\PG\MSF\CoroutineDns

Class Dns

Summary

Methods
Properties
Constants
__construct()
getResult()
throwTimeOutException()
isTimeout()
nextRun()
destroy()
__unsleep()
breakx()
setTimeout()
send()
$maxTimeout
$request
$result
$timeout
$requestTime
$responseTime
$ioBack
$ioBackKey
$isBreak
$requestId
$client
$headers
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$maxTimeout

$maxTimeout : integer

Type

integer — 协程运行的最大超时时间

$request

$request : string

Type

string — 请求参数

$result

$result : mixed

Type

mixed — IO协程运行的结束

$timeout

$timeout : integer

Type

integer — 协程执行的超时时间精确到ms

$requestTime

$requestTime : float

Type

float — 协程执行请求开始时间

$responseTime

$responseTime : float

Type

float — 协程执行请求结束时间

$ioBack

$ioBack : boolean

Type

boolean — IO协程是否返回数据

$ioBackKey

$ioBackKey : integer|null

Type

integer|null — ioBack标识

$isBreak

$isBreak : boolean

Type

boolean — 是否发送异步请求后不需要执行回调

$requestId

$requestId : string|null

Type

string|null — 整个请求标识

$headers

$headers : array

Type

array — 请求的额外HTTP报头

Methods

__construct()

__construct(\PG\MSF\Client\Http\Client  $client, integer  $timeout, array  $headers = array()) 

Dns constructor.

Parameters

\PG\MSF\Client\Http\Client $client

Client实例

integer $timeout

DNS解析超时时间,单位毫秒

array $headers

HTTP请求的报头列表

getResult()

getResult() : mixed|null

获取协程执行结果

Returns

mixed|null

throwTimeOutException()

throwTimeOutException() 

协程超时异常

Throws

\Exception

isTimeout()

isTimeout() : boolean

判断协程是否超时

Returns

boolean

nextRun()

nextRun() : boolean

通知调度器进行下一次迭代

Returns

boolean

destroy()

destroy() 

销毁

__unsleep()

__unsleep() : array

属性不用于序列化

Returns

array

breakx()

breakx() : boolean

发送异步请求后不需要执行回调

Returns

boolean

setTimeout()

setTimeout(integer  $timeout) : $this

手工设置超时时间

Parameters

integer $timeout

超时时间,单位毫秒

Returns

$this

send()

send(callable  $callback) : $this

发送DNS查询请求

Parameters

callable $callback

DNS解析完成后的回调

Returns

$this