mirror of
https://github.com/curl/curl.git
synced 2026-06-08 02:44:16 +03:00
changing the first handler->getsock method
This commit is contained in:
parent
cab43414f9
commit
1dffb13e93
24 changed files with 181 additions and 73 deletions
|
|
@ -81,7 +81,7 @@ const struct Curl_handler Curl_handler_rtmp = {
|
|||
rtmp_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -106,7 +106,7 @@ const struct Curl_handler Curl_handler_rtmpt = {
|
|||
rtmp_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -131,7 +131,7 @@ const struct Curl_handler Curl_handler_rtmpe = {
|
|||
rtmp_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -156,7 +156,7 @@ const struct Curl_handler Curl_handler_rtmpte = {
|
|||
rtmp_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -181,7 +181,7 @@ const struct Curl_handler Curl_handler_rtmps = {
|
|||
rtmp_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -206,7 +206,7 @@ const struct Curl_handler Curl_handler_rtmpts = {
|
|||
rtmp_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ const struct Curl_handler Curl_handler_dict = {
|
|||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ const struct Curl_handler Curl_handler_file = {
|
|||
file_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
13
lib/ftp.c
13
lib/ftp.c
|
|
@ -217,6 +217,8 @@ static CURLcode ftp_multi_statemach(struct Curl_easy *data, bool *done);
|
|||
static unsigned int ftp_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
static CURLcode ftp_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static unsigned int ftp_domore_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
|
|
@ -259,7 +261,7 @@ const struct Curl_handler Curl_handler_ftp = {
|
|||
ftp_connect, /* connect_it */
|
||||
ftp_multi_statemach, /* connecting */
|
||||
ftp_doing, /* doing */
|
||||
ftp_getsock, /* proto_getsock */
|
||||
ftp_pollset, /* proto_pollset */
|
||||
ftp_getsock, /* doing_getsock */
|
||||
ftp_domore_getsock, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -292,7 +294,7 @@ const struct Curl_handler Curl_handler_ftps = {
|
|||
ftp_connect, /* connect_it */
|
||||
ftp_multi_statemach, /* connecting */
|
||||
ftp_doing, /* doing */
|
||||
ftp_getsock, /* proto_getsock */
|
||||
ftp_pollset, /* proto_pollset */
|
||||
ftp_getsock, /* doing_getsock */
|
||||
ftp_domore_getsock, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -791,6 +793,13 @@ static unsigned int ftp_getsock(struct Curl_easy *data,
|
|||
return ftpc ? Curl_pp_getsock(data, &ftpc->pp, socks) : GETSOCK_BLANK;
|
||||
}
|
||||
|
||||
static CURLcode ftp_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
struct ftp_conn *ftpc = Curl_conn_meta_get(data->conn, CURL_META_FTP_CONN);
|
||||
return ftpc ? Curl_pp_pollset(data, &ftpc->pp, ps) : CURLE_OK;
|
||||
}
|
||||
|
||||
/* For the FTP "DO_MORE" phase only */
|
||||
static unsigned int ftp_domore_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ const struct Curl_handler Curl_handler_gopher = {
|
|||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -96,7 +96,7 @@ const struct Curl_handler Curl_handler_gophers = {
|
|||
gopher_connect, /* connect_it */
|
||||
gopher_connecting, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ const struct Curl_handler Curl_handler_http = {
|
|||
Curl_http_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
Curl_http_getsock_do, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -167,7 +167,7 @@ const struct Curl_handler Curl_handler_https = {
|
|||
Curl_http_connect, /* connect_it */
|
||||
NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
NULL, /* proto_getsock */
|
||||
NULL, /* proto_pollset */
|
||||
Curl_http_getsock_do, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
14
lib/imap.c
14
lib/imap.c
|
|
@ -160,6 +160,8 @@ static CURLcode imap_multi_statemach(struct Curl_easy *data, bool *done);
|
|||
static unsigned int imap_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
static CURLcode imap_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static CURLcode imap_doing(struct Curl_easy *data, bool *dophase_done);
|
||||
static CURLcode imap_setup_connection(struct Curl_easy *data,
|
||||
struct connectdata *conn);
|
||||
|
|
@ -197,7 +199,7 @@ const struct Curl_handler Curl_handler_imap = {
|
|||
imap_connect, /* connect_it */
|
||||
imap_multi_statemach, /* connecting */
|
||||
imap_doing, /* doing */
|
||||
imap_getsock, /* proto_getsock */
|
||||
imap_pollset, /* proto_pollset */
|
||||
imap_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -228,7 +230,7 @@ const struct Curl_handler Curl_handler_imaps = {
|
|||
imap_connect, /* connect_it */
|
||||
imap_multi_statemach, /* connecting */
|
||||
imap_doing, /* doing */
|
||||
imap_getsock, /* proto_getsock */
|
||||
imap_pollset, /* proto_pollset */
|
||||
imap_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -1570,6 +1572,14 @@ static unsigned int imap_getsock(struct Curl_easy *data,
|
|||
Curl_pp_getsock(data, &imapc->pp, socks) : GETSOCK_BLANK;
|
||||
}
|
||||
|
||||
static CURLcode imap_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
struct imap_conn *imapc =
|
||||
Curl_conn_meta_get(data->conn, CURL_META_IMAP_CONN);
|
||||
return imapc ? Curl_pp_pollset(data, &imapc->pp, ps) : CURLE_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* imap_connect()
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ const struct Curl_handler Curl_handler_ldap = {
|
|||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -207,7 +207,7 @@ const struct Curl_handler Curl_handler_ldaps = {
|
|||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ const struct Curl_handler Curl_handler_mqtt = {
|
|||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
mqtt_doing, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
mqtt_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
59
lib/multi.c
59
lib/multi.c
|
|
@ -907,40 +907,33 @@ void Curl_attach_connection(struct Curl_easy *data,
|
|||
conn->handler->attach(data, conn);
|
||||
}
|
||||
|
||||
static unsigned int connecting_getsock(struct Curl_easy *data,
|
||||
curl_socket_t *socks)
|
||||
static CURLcode mstate_connecting_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
curl_socket_t sockfd;
|
||||
|
||||
if(!conn)
|
||||
return GETSOCK_BLANK;
|
||||
sockfd = Curl_conn_get_socket(data, FIRSTSOCKET);
|
||||
if(sockfd != CURL_SOCKET_BAD) {
|
||||
/* Default is to wait to something from the server */
|
||||
socks[0] = sockfd;
|
||||
return GETSOCK_READSOCK(0);
|
||||
if(data->conn) {
|
||||
curl_socket_t sockfd = Curl_conn_get_socket(data, FIRSTSOCKET);
|
||||
if(sockfd != CURL_SOCKET_BAD) {
|
||||
/* Default is to wait to something from the server */
|
||||
return Curl_pollset_change(data, ps, sockfd, CURL_POLL_IN, 0);
|
||||
}
|
||||
}
|
||||
return GETSOCK_BLANK;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static unsigned int protocol_getsock(struct Curl_easy *data,
|
||||
curl_socket_t *socks)
|
||||
static CURLcode mstate_protocol_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
curl_socket_t sockfd;
|
||||
|
||||
if(!conn)
|
||||
return GETSOCK_BLANK;
|
||||
if(conn->handler->proto_getsock)
|
||||
return conn->handler->proto_getsock(data, conn, socks);
|
||||
sockfd = Curl_conn_get_socket(data, FIRSTSOCKET);
|
||||
if(sockfd != CURL_SOCKET_BAD) {
|
||||
/* Default is to wait to something from the server */
|
||||
socks[0] = sockfd;
|
||||
return GETSOCK_READSOCK(0);
|
||||
if(data->conn) {
|
||||
curl_socket_t sockfd;
|
||||
if(data->conn->handler->proto_pollset)
|
||||
return data->conn->handler->proto_pollset(data, ps);
|
||||
sockfd = Curl_conn_get_socket(data, FIRSTSOCKET);
|
||||
if(sockfd != CURL_SOCKET_BAD) {
|
||||
/* Default is to wait to something from the server */
|
||||
return Curl_pollset_change(data, ps, sockfd, CURL_POLL_IN, 0);
|
||||
}
|
||||
}
|
||||
return GETSOCK_BLANK;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static unsigned int domore_getsock(struct Curl_easy *data,
|
||||
|
|
@ -1045,14 +1038,16 @@ CURLMcode Curl_multi_getsock(struct Curl_easy *data,
|
|||
|
||||
case MSTATE_CONNECTING:
|
||||
case MSTATE_TUNNELING:
|
||||
Curl_pollset_add_socks(data, ps, connecting_getsock);
|
||||
Curl_conn_adjust_pollset(data, data->conn, ps);
|
||||
result = mstate_connecting_pollset(data, ps);
|
||||
if(!result)
|
||||
Curl_conn_adjust_pollset(data, data->conn, ps);
|
||||
break;
|
||||
|
||||
case MSTATE_PROTOCONNECT:
|
||||
case MSTATE_PROTOCONNECTING:
|
||||
Curl_pollset_add_socks(data, ps, protocol_getsock);
|
||||
Curl_conn_adjust_pollset(data, data->conn, ps);
|
||||
result = mstate_protocol_pollset(data, ps);
|
||||
if(!result)
|
||||
Curl_conn_adjust_pollset(data, data->conn, ps);
|
||||
break;
|
||||
|
||||
case MSTATE_DO:
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ const struct Curl_handler Curl_handler_ldap = {
|
|||
oldap_connect, /* connect_it */
|
||||
oldap_connecting, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -156,7 +156,7 @@ const struct Curl_handler Curl_handler_ldaps = {
|
|||
oldap_connect, /* connect_it */
|
||||
oldap_connecting, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
|
|
@ -413,6 +413,15 @@ unsigned int Curl_pp_getsock(struct Curl_easy *data,
|
|||
return GETSOCK_READSOCK(0);
|
||||
}
|
||||
|
||||
CURLcode Curl_pp_pollset(struct Curl_easy *data,
|
||||
struct pingpong *pp,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
int flags = pp->sendleft ? CURL_POLL_OUT : CURL_POLL_IN;
|
||||
return Curl_pollset_change(data, ps, data->conn->sock[FIRSTSOCKET],
|
||||
flags, 0);
|
||||
}
|
||||
|
||||
bool Curl_pp_needs_flush(struct Curl_easy *data,
|
||||
struct pingpong *pp)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -150,6 +150,9 @@ CURLcode Curl_pp_disconnect(struct pingpong *pp);
|
|||
unsigned int Curl_pp_getsock(struct Curl_easy *data,
|
||||
struct pingpong *pp,
|
||||
curl_socket_t *socks);
|
||||
CURLcode Curl_pp_pollset(struct Curl_easy *data,
|
||||
struct pingpong *pp,
|
||||
struct easy_pollset *ps);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
|||
14
lib/pop3.c
14
lib/pop3.c
|
|
@ -156,6 +156,8 @@ static CURLcode pop3_multi_statemach(struct Curl_easy *data, bool *done);
|
|||
static unsigned int pop3_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
static CURLcode pop3_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static CURLcode pop3_doing(struct Curl_easy *data, bool *dophase_done);
|
||||
static CURLcode pop3_setup_connection(struct Curl_easy *data,
|
||||
struct connectdata *conn);
|
||||
|
|
@ -187,7 +189,7 @@ const struct Curl_handler Curl_handler_pop3 = {
|
|||
pop3_connect, /* connect_it */
|
||||
pop3_multi_statemach, /* connecting */
|
||||
pop3_doing, /* doing */
|
||||
pop3_getsock, /* proto_getsock */
|
||||
pop3_pollset, /* proto_pollset */
|
||||
pop3_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -218,7 +220,7 @@ const struct Curl_handler Curl_handler_pop3s = {
|
|||
pop3_connect, /* connect_it */
|
||||
pop3_multi_statemach, /* connecting */
|
||||
pop3_doing, /* doing */
|
||||
pop3_getsock, /* proto_getsock */
|
||||
pop3_pollset, /* proto_pollset */
|
||||
pop3_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -1280,6 +1282,14 @@ static unsigned int pop3_getsock(struct Curl_easy *data,
|
|||
return GETSOCK_BLANK;
|
||||
}
|
||||
|
||||
static CURLcode pop3_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
struct pop3_conn *pop3c =
|
||||
Curl_conn_meta_get(data->conn, CURL_META_POP3_CONN);
|
||||
return pop3c ? Curl_pp_pollset(data, &pop3c->pp, ps) : CURLE_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* pop3_connect()
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ const struct Curl_handler Curl_handler_rtsp = {
|
|||
rtsp_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
rtsp_getsock_do, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
12
lib/smb.c
12
lib/smb.c
|
|
@ -302,6 +302,8 @@ static CURLcode smb_request_state(struct Curl_easy *data, bool *done);
|
|||
static unsigned int smb_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
static CURLcode smb_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static CURLcode smb_parse_url_path(struct Curl_easy *data,
|
||||
struct smb_conn *smbc,
|
||||
struct smb_request *req);
|
||||
|
|
@ -318,7 +320,7 @@ const struct Curl_handler Curl_handler_smb = {
|
|||
smb_connect, /* connect_it */
|
||||
smb_connection_state, /* connecting */
|
||||
smb_request_state, /* doing */
|
||||
smb_getsock, /* proto_getsock */
|
||||
smb_pollset, /* proto_pollset */
|
||||
smb_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -347,7 +349,7 @@ const struct Curl_handler Curl_handler_smbs = {
|
|||
smb_connect, /* connect_it */
|
||||
smb_connection_state, /* connecting */
|
||||
smb_request_state, /* doing */
|
||||
smb_getsock, /* proto_getsock */
|
||||
smb_pollset, /* proto_pollset */
|
||||
smb_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -1215,6 +1217,12 @@ static unsigned int smb_getsock(struct Curl_easy *data,
|
|||
return GETSOCK_READSOCK(0) | GETSOCK_WRITESOCK(0);
|
||||
}
|
||||
|
||||
static CURLcode smb_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
return Curl_pollset_add_inout(data, ps, data->conn->sock[FIRSTSOCKET]);
|
||||
}
|
||||
|
||||
static CURLcode smb_do(struct Curl_easy *data, bool *done)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
|
|
|
|||
14
lib/smtp.c
14
lib/smtp.c
|
|
@ -160,6 +160,8 @@ static CURLcode smtp_multi_statemach(struct Curl_easy *data, bool *done);
|
|||
static unsigned int smtp_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
static CURLcode smtp_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static CURLcode smtp_doing(struct Curl_easy *data, bool *dophase_done);
|
||||
static CURLcode smtp_setup_connection(struct Curl_easy *data,
|
||||
struct connectdata *conn);
|
||||
|
|
@ -193,7 +195,7 @@ const struct Curl_handler Curl_handler_smtp = {
|
|||
smtp_connect, /* connect_it */
|
||||
smtp_multi_statemach, /* connecting */
|
||||
smtp_doing, /* doing */
|
||||
smtp_getsock, /* proto_getsock */
|
||||
smtp_pollset, /* proto_pollset */
|
||||
smtp_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -224,7 +226,7 @@ const struct Curl_handler Curl_handler_smtps = {
|
|||
smtp_connect, /* connect_it */
|
||||
smtp_multi_statemach, /* connecting */
|
||||
smtp_doing, /* doing */
|
||||
smtp_getsock, /* proto_getsock */
|
||||
smtp_pollset, /* proto_pollset */
|
||||
smtp_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -1423,6 +1425,14 @@ static unsigned int smtp_getsock(struct Curl_easy *data,
|
|||
Curl_pp_getsock(data, &smtpc->pp, socks) : GETSOCK_BLANK;
|
||||
}
|
||||
|
||||
static CURLcode smtp_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
struct smtp_conn *smtpc =
|
||||
Curl_conn_meta_get(data->conn, CURL_META_SMTP_CONN);
|
||||
return smtpc ? Curl_pp_pollset(data, &smtpc->pp, ps) : CURLE_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* smtp_connect()
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ const struct Curl_handler Curl_handler_telnet = {
|
|||
ZERO_NULL, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
ZERO_NULL, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
10
lib/tftp.c
10
lib/tftp.c
|
|
@ -163,6 +163,8 @@ static CURLcode tftp_doing(struct Curl_easy *data, bool *dophase_done);
|
|||
static unsigned int tftp_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
static CURLcode tftp_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static CURLcode tftp_translate_code(tftp_error_t error);
|
||||
|
||||
|
||||
|
|
@ -179,7 +181,7 @@ const struct Curl_handler Curl_handler_tftp = {
|
|||
tftp_connect, /* connect_it */
|
||||
tftp_multi_statemach, /* connecting */
|
||||
tftp_doing, /* doing */
|
||||
tftp_getsock, /* proto_getsock */
|
||||
tftp_pollset, /* proto_pollset */
|
||||
tftp_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -1091,6 +1093,12 @@ static unsigned int tftp_getsock(struct Curl_easy *data,
|
|||
return GETSOCK_READSOCK(0);
|
||||
}
|
||||
|
||||
static CURLcode tftp_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
return Curl_pollset_add_in(data, ps, data->conn->sock[FIRSTSOCKET]);
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
* tftp_receive_packet
|
||||
|
|
|
|||
|
|
@ -507,9 +507,8 @@ struct Curl_handler {
|
|||
|
||||
/* Called from the multi interface during the PROTOCONNECT phase, and it
|
||||
should then return a proper fd set */
|
||||
unsigned int (*proto_getsock)(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *socks);
|
||||
CURLcode (*proto_pollset)(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
|
||||
/* Called from the multi interface during the DOING phase, and it should
|
||||
then return a proper fd set */
|
||||
|
|
|
|||
|
|
@ -128,6 +128,8 @@ CURLcode sftp_perform(struct Curl_easy *data,
|
|||
static unsigned int myssh_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *sock);
|
||||
static CURLcode myssh_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static void myssh_block2waitfor(struct connectdata *conn,
|
||||
struct ssh_conn *sshc,
|
||||
bool block);
|
||||
|
|
@ -149,7 +151,7 @@ const struct Curl_handler Curl_handler_scp = {
|
|||
myssh_connect, /* connect_it */
|
||||
myssh_multi_statemach, /* connecting */
|
||||
scp_doing, /* doing */
|
||||
myssh_getsock, /* proto_getsock */
|
||||
myssh_pollset, /* proto_pollset */
|
||||
myssh_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
myssh_getsock, /* perform_getsock */
|
||||
|
|
@ -178,7 +180,7 @@ const struct Curl_handler Curl_handler_sftp = {
|
|||
myssh_connect, /* connect_it */
|
||||
myssh_multi_statemach, /* connecting */
|
||||
sftp_doing, /* doing */
|
||||
myssh_getsock, /* proto_getsock */
|
||||
myssh_pollset, /* proto_pollset */
|
||||
myssh_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
myssh_getsock, /* perform_getsock */
|
||||
|
|
@ -2412,6 +2414,21 @@ static unsigned int myssh_getsock(struct Curl_easy *data,
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
static CURLcode myssh_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
int flags = 0;
|
||||
if(data->conn->waitfor & KEEP_RECV)
|
||||
flags |= CURL_POLL_IN;
|
||||
if(data->conn->waitfor & KEEP_SEND)
|
||||
flags |= CURL_POLL_OUT;
|
||||
if(!data->conn->waitfor)
|
||||
flags |= CURL_POLL_OUT;
|
||||
return flags ?
|
||||
Curl_pollset_change(data, ps, data->conn->sock[FIRSTSOCKET], flags, 0) :
|
||||
CURLE_OK;
|
||||
}
|
||||
|
||||
static void myssh_block2waitfor(struct connectdata *conn,
|
||||
struct ssh_conn *sshc,
|
||||
bool block)
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ static CURLcode sftp_perform(struct Curl_easy *data, bool *connected,
|
|||
static unsigned int ssh_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *sock);
|
||||
static CURLcode ssh_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static CURLcode ssh_setup_connection(struct Curl_easy *data,
|
||||
struct connectdata *conn);
|
||||
static void ssh_attach(struct Curl_easy *data, struct connectdata *conn);
|
||||
|
|
@ -120,7 +122,7 @@ const struct Curl_handler Curl_handler_scp = {
|
|||
ssh_connect, /* connect_it */
|
||||
ssh_multi_statemach, /* connecting */
|
||||
scp_doing, /* doing */
|
||||
ssh_getsock, /* proto_getsock */
|
||||
ssh_pollset, /* proto_pollset */
|
||||
ssh_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ssh_getsock, /* perform_getsock */
|
||||
|
|
@ -151,7 +153,7 @@ const struct Curl_handler Curl_handler_sftp = {
|
|||
ssh_connect, /* connect_it */
|
||||
ssh_multi_statemach, /* connecting */
|
||||
sftp_doing, /* doing */
|
||||
ssh_getsock, /* proto_getsock */
|
||||
ssh_pollset, /* proto_pollset */
|
||||
ssh_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ssh_getsock, /* perform_getsock */
|
||||
|
|
@ -3106,6 +3108,19 @@ static unsigned int ssh_getsock(struct Curl_easy *data,
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
static CURLcode ssh_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
int flags = 0;
|
||||
if(data->conn->waitfor & KEEP_RECV)
|
||||
flags |= CURL_POLL_IN;
|
||||
if(data->conn->waitfor & KEEP_SEND)
|
||||
flags |= CURL_POLL_OUT;
|
||||
return flags ?
|
||||
Curl_pollset_change(data, ps, data->conn->sock[FIRSTSOCKET], flags, 0) :
|
||||
CURLE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* When one of the libssh2 functions has returned LIBSSH2_ERROR_EAGAIN this
|
||||
* function is used to figure out in what direction and stores this info so
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ static CURLcode wsftp_disconnect(struct Curl_easy *data,
|
|||
static unsigned int wssh_getsock(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
curl_socket_t *sock);
|
||||
static CURLcode wssh_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps);
|
||||
static CURLcode wssh_setup_connection(struct Curl_easy *data,
|
||||
struct connectdata *conn);
|
||||
static void wssh_sshc_cleanup(struct ssh_conn *sshc);
|
||||
|
|
@ -87,7 +89,7 @@ const struct Curl_handler Curl_handler_scp = {
|
|||
wssh_connect, /* connect_it */
|
||||
wssh_multi_statemach, /* connecting */
|
||||
wscp_doing, /* doing */
|
||||
wssh_getsock, /* proto_getsock */
|
||||
wssh_pollset, /* proto_pollset */
|
||||
wssh_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
wssh_getsock, /* perform_getsock */
|
||||
|
|
@ -118,7 +120,7 @@ const struct Curl_handler Curl_handler_sftp = {
|
|||
wssh_connect, /* connect_it */
|
||||
wssh_multi_statemach, /* connecting */
|
||||
wsftp_doing, /* doing */
|
||||
wssh_getsock, /* proto_getsock */
|
||||
wssh_pollset, /* proto_pollset */
|
||||
wssh_getsock, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
wssh_getsock, /* perform_getsock */
|
||||
|
|
@ -1202,6 +1204,19 @@ static unsigned int wssh_getsock(struct Curl_easy *data,
|
|||
return bitmap;
|
||||
}
|
||||
|
||||
static CURLcode wssh_pollset(struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
int flags = 0;
|
||||
if(data->conn->waitfor & KEEP_RECV)
|
||||
flags |= CURL_POLL_IN;
|
||||
if(data->conn->waitfor & KEEP_SEND)
|
||||
flags |= CURL_POLL_OUT;
|
||||
return flags ?
|
||||
Curl_pollset_change(data, ps, data->conn->sock[FIRSTSOCKET], flags, 0) :
|
||||
CURLE_OK;
|
||||
}
|
||||
|
||||
void Curl_ssh_version(char *buffer, size_t buflen)
|
||||
{
|
||||
(void)msnprintf(buffer, buflen, "wolfssh/%s", LIBWOLFSSH_VERSION_STRING);
|
||||
|
|
|
|||
4
lib/ws.c
4
lib/ws.c
|
|
@ -1552,7 +1552,7 @@ const struct Curl_handler Curl_handler_ws = {
|
|||
Curl_http_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
ZERO_NULL, /* proto_pollset */
|
||||
Curl_http_getsock_do, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
@ -1579,7 +1579,7 @@ const struct Curl_handler Curl_handler_wss = {
|
|||
Curl_http_connect, /* connect_it */
|
||||
NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
NULL, /* proto_getsock */
|
||||
NULL, /* proto_pollset */
|
||||
Curl_http_getsock_do, /* doing_getsock */
|
||||
ZERO_NULL, /* domore_getsock */
|
||||
ZERO_NULL, /* perform_getsock */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue