Unverified Commit be6e281c authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

multi: provide Curl_multiuse_state to update information

As soon as a TLS backend gets ALPN conformation about the specific HTTP
version it can now set the multiplex situation for the "bundle" and
trigger moving potentially queued up transfers to the CONNECT state.
parent 5c8783d7
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -2981,6 +2981,22 @@ size_t Curl_multi_max_total_connections(struct Curl_multi *multi)
  return multi ? multi->max_total_connections : 0;
}

/*
 * When information about a connection has appeared, call this!
 */

void Curl_multiuse_state(struct connectdata *conn,
                         int bundlestate) /* use BUNDLE_* defines */
{
  DEBUGASSERT(conn);
  DEBUGASSERT(conn->bundle);
  DEBUGASSERT(conn->data);
  DEBUGASSERT(conn->data->multi);

  conn->bundle->multiuse = bundlestate;
  process_pending_handles(conn->data->multi);
}

static void process_pending_handles(struct Curl_multi *multi)
{
  struct curl_llist_element *e = multi->pending.head;
+3 −0
Original line number Diff line number Diff line
@@ -82,6 +82,9 @@ size_t Curl_multi_max_total_connections(struct Curl_multi *multi);

void Curl_multi_connchanged(struct Curl_multi *multi);

void Curl_multiuse_state(struct connectdata *conn,
                         int bundlestate); /* use BUNDLE_* defines */

/*
 * Curl_multi_closed()
 *
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ and that's a problem since options.h hasn't been included yet. */
#include "strcase.h"
#include "x509asn1.h"
#include "curl_printf.h"
#include "multiif.h"

#include <cyassl/openssl/ssl.h>
#include <cyassl/ssl.h>
@@ -599,6 +600,8 @@ cyassl_connect_step2(struct connectdata *conn,
      else
        infof(data, "ALPN, unrecognized protocol %.*s\n", protocol_len,
              protocol);
      Curl_multiuse_state(conn, conn->negnpn == CURL_HTTP_VERSION_2 ?
                          BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
    }
    else if(rc == SSL_ALPN_NOT_FOUND)
      infof(data, "ALPN, server did not agree to a protocol\n");
+4 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
#include "strcase.h"
#include "warnless.h"
#include "x509asn1.h"
#include "multiif.h"
#include "curl_printf.h"
#include "curl_memory.h"
/* The last #include file should be: */
@@ -1449,6 +1450,9 @@ gtls_connect_step3(struct connectdata *conn,
    }
    else
      infof(data, "ALPN, server did not agree to a protocol\n");

    Curl_multiuse_state(conn, conn->negnpn == CURL_HTTP_VERSION_2 ?
                        BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
  }
#endif

+3 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include "parsedate.h"
#include "connect.h" /* for the connect timeout */
#include "select.h"
#include "multiif.h"
#include "polarssl_threadlock.h"

/* The last 3 #include files should be in this order */
@@ -684,6 +685,8 @@ mbed_connect_step2(struct connectdata *conn,
    else {
      infof(data, "ALPN, server did not agree to a protocol\n");
    }
    Curl_multiuse_state(conn, conn->negnpn == CURL_HTTP_VERSION_2 ?
                        BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
  }
#endif

Loading