Lines Matching full:connection
21 * @brief tests new connection callback. spdycli.c
107 struct Connection {
110 /* WANT_READ if SSL connection needs more input; or WANT_WRITE if it
115 SSL connection. */
228 struct Connection *connection;
230 connection = (struct Connection*)user_data;
231 connection->want_io = IO_NONE;
233 rv = SSL_write(connection->ssl, data, length);
235 int err = SSL_get_error(connection->ssl, rv);
237 connection->want_io = (err == SSL_ERROR_WANT_READ ?
260 struct Connection *connection;
262 connection = (struct Connection*)user_data;
263 connection->want_io = IO_NONE;
265 rv = SSL_read(connection->ssl, buf, length);
267 int err = SSL_get_error(connection->ssl, rv);
269 connection->want_io = (err == SSL_ERROR_WANT_READ ?
574 * Update |pollfd| based on the state of |connection|.
576 static void ctl_poll(struct pollfd *pollfd, struct Connection *connection)
579 if(spdylay_session_want_read(connection->session) ||
580 connection->want_io == WANT_READ) {
583 if(spdylay_session_want_write(connection->session) ||
584 connection->want_io == WANT_WRITE) {
590 * Submits the request |req| to the connection |connection|. This
592 * internal queue in |connection->session|.
594 static void submit_request(struct Connection *connection, struct Request *req)
610 rv = spdylay_submit_request(connection->session, pri, nv, NULL, req);
619 static void exec_io(struct Connection *connection)
622 rv = spdylay_session_recv(connection->session);
626 rv = spdylay_session_send(connection->session);
660 struct Connection connection;
670 /* Establish connection and setup SSL */
687 connection.ssl = ssl;
688 connection.want_io = IO_NONE;
695 rv = spdylay_session_client_new(&connection.session, spdy_proto_version,
696 &callbacks, &connection);
702 submit_request(&connection, &req);
705 ctl_poll(pollfds, &connection);
708 while(spdylay_session_want_read(connection.session) ||
709 spdylay_session_want_write(connection.session)) {
715 exec_io(&connection);
718 die("Connection error");
720 ctl_poll(pollfds, &connection);
724 spdylay_session_del(connection.session);
851 printf("New connection from: %s:%i\n", ipstr, ntohs(addr4->sin_port));
863 printf("New connection from: %s:%i\n", ipstr, ntohs(addr6->sin6_port));