aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-03-13 23:21:03 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-03-13 23:21:03 +0100
commit3eac14b43c62717cc14733aba6827c0c3d38dc9a (patch)
treef4bce1b937b546536d4ac43cae12c77169e673ec /lib/multi.c
parent60406ff7f87c950be8eee96760f9358547594bc6 (diff)
SSH: add protocol lock direction
Some protocols have to call the underlying functions without regard to what exact state the socket signals. For example even if the socket says "readable", the send function might need to be called while uploading, or vice versa. This is the case for libssh2 based protocols: SCP and SFTP and we now introduce a define to set those protocols and we make the multi interface code aware of this concept. This is another fix to make test 582 run properly.
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 91d92df90..d68c368f3 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -2105,35 +2105,41 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
and just move on. */
;
else {
+ struct connectdata *conn;
data = entry->easy;
if(data->magic != CURLEASY_MAGIC_NUMBER)
/* bad bad bad bad bad bad bad */
return CURLM_INTERNAL_ERROR;
+ /* note that this can possibly be NULL at this point */
+ conn = data->set.one_easy->easy_conn;
+
/* If the pipeline is enabled, take the handle which is in the head of
the pipeline. If we should write into the socket, take the send_pipe
head. If we should read from the socket, take the recv_pipe head. */
- if(data->set.one_easy->easy_conn) {
+ if(conn) {
if ((ev_bitmask & CURL_POLL_OUT) &&
- data->set.one_easy->easy_conn->send_pipe &&
- data->set.one_easy->easy_conn->send_pipe->head)
- data = data->set.one_easy->easy_conn->send_pipe->head->ptr;
+ conn->send_pipe &&
+ conn->send_pipe->head)
+ data = conn->send_pipe->head->ptr;
else if ((ev_bitmask & CURL_POLL_IN) &&
- data->set.one_easy->easy_conn->recv_pipe &&
- data->set.one_easy->easy_conn->recv_pipe->head)
- data = data->set.one_easy->easy_conn->recv_pipe->head->ptr;
+ conn->recv_pipe &&
+ conn->recv_pipe->head)
+ data = conn->recv_pipe->head->ptr;
}
- if(data->set.one_easy->easy_conn) /* set socket event bitmask */
- data->set.one_easy->easy_conn->cselect_bits = ev_bitmask;
+ if(conn && !(conn->handler->protocol & PROT_LOCKEDBITS))
+ /* set socket event bitmask if they're not locked */
+ conn->cselect_bits = ev_bitmask;
do
result = multi_runsingle(multi, now, data->set.one_easy);
while (CURLM_CALL_MULTI_PERFORM == result);
- if(data->set.one_easy->easy_conn)
- data->set.one_easy->easy_conn->cselect_bits = 0;
+ if(conn && !(conn->handler->protocol & PROT_LOCKEDBITS))
+ /* clear the bitmask only if not locked */
+ conn->cselect_bits = 0;
if(CURLM_OK >= result)
/* get the socket(s) and check if the state has been changed since