Home | History | Annotate | Download | only in examples

Lines Matching defs:connection

21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
146 struct SPDY_Connection *connection;
148 connection = (struct SPDY_Connection*)user_data;
149 connection->want_io = IO_NONE;
164 if(connection->is_tls)
167 rv = SSL_write(connection->ssl, data, length);
169 int err = SSL_get_error(connection->ssl, rv);
171 connection->want_io |= (err == SSL_ERROR_WANT_READ ?
181 rv = write(connection->fd,
193 connection->want_io |= WANT_WRITE;
228 struct SPDY_Connection *connection;
231 connection = (struct SPDY_Connection*)user_data;
233 if(!(++connection->counter % 10)) return SPDYLAY_ERR_WOULDBLOCK;
234 connection->want_io = IO_NONE;
235 if(connection->is_tls)
238 rv = SSL_read(connection->ssl, buf, length);
240 int err = SSL_get_error(connection->ssl, rv);
242 connection->want_io |= (err == SSL_ERROR_WANT_READ ?
254 rv = read(connection->fd,
266 connection->want_io |= WANT_READ;
646 * Update |pollfd| based on the state of |connection|.
651 struct SPDY_Connection *connection)
654 if(spdylay_session_want_read(connection->session) ||
655 connection->want_io & WANT_READ)
659 if(spdylay_session_want_write(connection->session) ||
660 connection->want_io & WANT_WRITE)
668 * Update |selectfd| based on the state of |connection|.
674 struct SPDY_Connection *connection)
680 if(spdylay_session_want_read(connection->session) ||
681 connection->want_io & WANT_READ)
683 FD_SET(connection->fd, read_fd_set);
686 if(spdylay_session_want_write(connection->session) ||
687 connection->want_io & WANT_WRITE)
689 FD_SET(connection->fd, write_fd_set);
701 spdy_exec_io(struct SPDY_Connection *connection)
705 rv = spdylay_session_recv(connection->session);
711 rv = spdylay_session_send(connection->session);
730 struct SPDY_Connection * connection = NULL;
735 /* Establish connection and setup SSL */
768 if(NULL == (connection = au_malloc(sizeof(struct SPDY_Connection))))
771 connection->is_tls = is_tls;
772 connection->ssl = ssl;
773 connection->want_io = IO_NONE;
774 if(NULL == (connection->host = strdup(uri->host)))
782 rv = spdylay_session_client_new(&(connection->session), glob_opt.spdy_proto_version,
783 &callbacks, connection);
788 connection->fd = fd;
790 return connection;
794 if(NULL != connection)
796 free(connection->host);
797 free(connection);
813 spdy_free_connection(struct SPDY_Connection * connection)
818 if(NULL != connection)
820 for(proxy = connection->proxies_head; NULL != proxy; proxy=proxy_next)
823 DLL_remove(connection->proxies_head, connection->proxies_tail, proxy);
832 spdylay_session_del(connection->session);
833 SSL_free(connection->ssl);
834 free(connection->host);
835 free(connection);
836 //connection->session = NULL;
848 struct SPDY_Connection *connection;
853 connection = glob_opt.spdy_connection;
857 connection = glob_opt.spdy_connections_head;
858 while(NULL != connection)
860 if(0 == strcasecmp(proxy->uri->host, connection->host))
862 connection = connection->next;
865 if(NULL == connection)
870 connection = spdy_connect(proxy->uri, port, true);
871 if(NULL != connection)
873 DLL_insert(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connection);
877 connection = glob_opt.spdy_connection;
881 if(NULL == connection)
887 proxy->spdy_connection = connection;
892 ret = spdylay_submit_request(connection->session, 0, nv, &post_data, proxy);
895 ret = spdylay_submit_request(connection->session, 0, nv, NULL, proxy);
901 if(NULL != connection->proxies_head)
902 PRINT_INFO2("before proxy %i", connection->proxies_head->id);
903 DLL_insert(connection->proxies_head, connection->proxies_tail, proxy);
915 struct SPDY_Connection *connection;
927 //PRINT_INFO("TODO drop connection");
947 connection = glob_opt.spdy_connections_head;
949 while(NULL != connection && *real_size < max_size)
952 spdy_ctl_poll(&(fds[*real_size]), connection);
955 //PRINT_INFO("TODO drop connection");
956 glob_opt.streams_opened -= connection->streams_opened;
957 DLL_remove(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connection);
960 for(proxy = connection->proxies_head; NULL != proxy; proxy=proxy->next)
963 DLL_remove(connection->proxies_head, connection->proxies_tail, proxy);
966 spdy_free_connection(connection);
970 fds[*real_size].fd = connection->fd;
971 connections[*real_size] = connection;
974 connection = connection->next;
978 assert(NULL == connection);
990 struct SPDY_Connection *connection;
1020 connection = glob_opt.spdy_connections_head;
1022 while(NULL != connection && *real_size < max_size)
1027 except_fd_set, connection);
1029 next_connection = connection->next;
1032 glob_opt.streams_opened -= connection->streams_opened;
1033 DLL_remove(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connection);
1037 spdy_free_connection(connection);
1041 connections[*real_size] = connection;
1043 if(maxfd < connection->fd) maxfd = connection->fd;
1045 connection = next_connection;
1049 assert(NULL == connection);
1144 //PRINT_INFO2("connection->want_io %i",connections[i]->want_io);