int Curl_resolv_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks) { const struct thread_data *td = (const struct thread_data *) conn->async.os_specific; if(td && td->dummy_sock != CURL_SOCKET_BAD) { if(numsocks) { /* return one socket waiting for readable, even though this is just a dummy */ socks[0] = td->dummy_sock; return GETSOCK_READSOCK(0); } } return 0; }
int Curl_pp_getsock(struct pingpong *pp, curl_socket_t *socks, int numsocks) { struct connectdata *conn = pp->conn; if(!numsocks) return GETSOCK_BLANK; socks[0] = conn->sock[FIRSTSOCKET]; if(pp->sendleft) { /* write mode */ return GETSOCK_WRITESOCK(0); } /* read mode */ return GETSOCK_READSOCK(0); }
int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks) { struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET]; if(!numsocks) return GETSOCK_BLANK; if(connssl->connecting_state == ssl_connect_2_writing) { /* write mode */ socks[0] = conn->sock[FIRSTSOCKET]; return GETSOCK_WRITESOCK(0); } if(connssl->connecting_state == ssl_connect_2_reading) { /* read mode */ socks[0] = conn->sock[FIRSTSOCKET]; return GETSOCK_READSOCK(0); } return GETSOCK_BLANK; }
static int http2_perform_getsock(const struct connectdata *conn, curl_socket_t *sock, /* points to numsocks number of sockets */ int numsocks) { const struct http_conn *httpc = &conn->proto.httpc; int bitmap = GETSOCK_BLANK; (void)numsocks; /* TODO We should check underlying socket state if it is SSL socket because of renegotiation. */ sock[0] = conn->sock[FIRSTSOCKET]; if(nghttp2_session_want_read(httpc->h2)) bitmap |= GETSOCK_READSOCK(FIRSTSOCKET); if(nghttp2_session_want_write(httpc->h2)) bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET); return bitmap; }