Lines Matching refs:pp
51 struct pingpong *pp, bool disconnecting) in Curl_pp_state_timeout() argument
56 data->set.server_response_timeout : pp->response_time; in Curl_pp_state_timeout()
66 Curl_timediff(Curl_now(), pp->response); /* spent time */ in Curl_pp_state_timeout()
84 struct pingpong *pp, bool block, in Curl_pp_statemach() argument
91 timediff_t timeout_ms = Curl_pp_state_timeout(data, pp, disconnecting); in Curl_pp_statemach()
109 else if(pp->overflow) in Curl_pp_statemach()
112 else if(!pp->sendleft && Curl_conn_data_pending(data, FIRSTSOCKET)) in Curl_pp_statemach()
116 rc = Curl_socket_check(pp->sendleft ? CURL_SOCKET_BAD : sock, /* reading */ in Curl_pp_statemach()
118 pp->sendleft ? sock : CURL_SOCKET_BAD, /* writing */ in Curl_pp_statemach()
137 result = pp->statemachine(data, data->conn); in Curl_pp_statemach()
143 void Curl_pp_init(struct pingpong *pp) in Curl_pp_init() argument
145 pp->nread_resp = 0; in Curl_pp_init()
146 pp->response = Curl_now(); /* start response time-out now! */ in Curl_pp_init()
147 pp->pending_resp = TRUE; in Curl_pp_init()
148 Curl_dyn_init(&pp->sendbuf, DYN_PINGPPONG_CMD); in Curl_pp_init()
149 Curl_dyn_init(&pp->recvbuf, DYN_PINGPPONG_CMD); in Curl_pp_init()
163 struct pingpong *pp, in Curl_pp_vsendf() argument
177 DEBUGASSERT(pp->sendleft == 0); in Curl_pp_vsendf()
178 DEBUGASSERT(pp->sendsize == 0); in Curl_pp_vsendf()
179 DEBUGASSERT(pp->sendthis == NULL); in Curl_pp_vsendf()
185 Curl_dyn_reset(&pp->sendbuf); in Curl_pp_vsendf()
186 result = Curl_dyn_vaddf(&pp->sendbuf, fmt, args); in Curl_pp_vsendf()
191 result = Curl_dyn_addn(&pp->sendbuf, "\r\n", 2); in Curl_pp_vsendf()
195 pp->pending_resp = TRUE; in Curl_pp_vsendf()
196 write_len = Curl_dyn_len(&pp->sendbuf); in Curl_pp_vsendf()
197 s = Curl_dyn_ptr(&pp->sendbuf); in Curl_pp_vsendf()
219 pp->sendthis = s; in Curl_pp_vsendf()
220 pp->sendsize = write_len; in Curl_pp_vsendf()
221 pp->sendleft = write_len - bytes_written; in Curl_pp_vsendf()
224 pp->sendthis = NULL; in Curl_pp_vsendf()
225 pp->sendleft = pp->sendsize = 0; in Curl_pp_vsendf()
226 pp->response = Curl_now(); in Curl_pp_vsendf()
243 CURLcode Curl_pp_sendf(struct Curl_easy *data, struct pingpong *pp, in Curl_pp_sendf() argument
250 result = Curl_pp_vsendf(data, pp, fmt, ap); in Curl_pp_sendf()
283 struct pingpong *pp, in Curl_pp_readresp() argument
297 if(pp->nfinal) { in Curl_pp_readresp()
300 size_t full = Curl_dyn_len(&pp->recvbuf); in Curl_pp_readresp()
303 Curl_dyn_tail(&pp->recvbuf, full - pp->nfinal); in Curl_pp_readresp()
305 pp->nfinal = 0; /* now gone */ in Curl_pp_readresp()
307 if(!pp->overflow) { in Curl_pp_readresp()
321 result = Curl_dyn_addn(&pp->recvbuf, buffer, gotbytes); in Curl_pp_readresp()
327 pp->nread_resp += gotbytes; in Curl_pp_readresp()
331 char *line = Curl_dyn_ptr(&pp->recvbuf); in Curl_pp_readresp()
332 char *nl = memchr(line, '\n', Curl_dyn_len(&pp->recvbuf)); in Curl_pp_readresp()
352 if(pp->endofresp(data, conn, line, length, code)) { in Curl_pp_readresp()
357 pp->nfinal = length; in Curl_pp_readresp()
358 if(Curl_dyn_len(&pp->recvbuf) > length) in Curl_pp_readresp()
359 pp->overflow = Curl_dyn_len(&pp->recvbuf) - length; in Curl_pp_readresp()
361 pp->overflow = 0; in Curl_pp_readresp()
362 *size = pp->nread_resp; /* size of the response */ in Curl_pp_readresp()
363 pp->nread_resp = 0; /* restart */ in Curl_pp_readresp()
367 if(Curl_dyn_len(&pp->recvbuf) > length) in Curl_pp_readresp()
369 Curl_dyn_tail((&pp->recvbuf), Curl_dyn_len(&pp->recvbuf) - length); in Curl_pp_readresp()
371 Curl_dyn_reset(&pp->recvbuf); in Curl_pp_readresp()
375 pp->overflow = 0; in Curl_pp_readresp()
383 pp->pending_resp = FALSE; in Curl_pp_readresp()
389 struct pingpong *pp, curl_socket_t *socks) in Curl_pp_getsock() argument
394 if(pp->sendleft) { in Curl_pp_getsock()
404 struct pingpong *pp) in Curl_pp_needs_flush() argument
407 return pp->sendleft > 0; in Curl_pp_needs_flush()
411 struct pingpong *pp) in Curl_pp_flushsend() argument
417 if(!Curl_pp_needs_flush(data, pp)) in Curl_pp_flushsend()
421 pp->sendthis + pp->sendsize - pp->sendleft, in Curl_pp_flushsend()
422 pp->sendleft, FALSE, &written); in Curl_pp_flushsend()
430 if(written != pp->sendleft) { in Curl_pp_flushsend()
432 pp->sendleft -= written; in Curl_pp_flushsend()
435 pp->sendthis = NULL; in Curl_pp_flushsend()
436 pp->sendleft = pp->sendsize = 0; in Curl_pp_flushsend()
437 pp->response = Curl_now(); in Curl_pp_flushsend()
442 CURLcode Curl_pp_disconnect(struct pingpong *pp) in Curl_pp_disconnect() argument
444 Curl_dyn_free(&pp->sendbuf); in Curl_pp_disconnect()
445 Curl_dyn_free(&pp->recvbuf); in Curl_pp_disconnect()
449 bool Curl_pp_moredata(struct pingpong *pp) in Curl_pp_moredata() argument
451 return (!pp->sendleft && Curl_dyn_len(&pp->recvbuf) > pp->nfinal); in Curl_pp_moredata()