Lines Matching full:connection
52 * safe_write writes data to the specified connection and tries to do it in
58 safe_write(struct cached_connection_ *connection, const void *data, in safe_write() argument
74 nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, in safe_write()
77 s_result = _sendto(connection->sockfd, data + result, in safe_write()
96 * safe_read reads data from connection and tries to do it in the very safe
102 safe_read(struct cached_connection_ *connection, void *data, size_t data_size) in safe_read() argument
117 nevents = _kevent(connection->read_queue, NULL, 0, &eventlist, in safe_read()
120 s_result = _read(connection->sockfd, data + result, in safe_read()
138 * Sends the credentials information to the connection along with the
142 send_credentials(struct cached_connection_ *connection, int type) in send_credentials() argument
168 EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD, in send_credentials()
170 (void)_kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL); in send_credentials()
172 nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1, in send_credentials()
175 result = _sendmsg(connection->sockfd, &mhdr, in send_credentials()
177 EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD, in send_credentials()
179 _kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL); in send_credentials()
186 * Opens the connection with the specified params. Initializes all kqueues.
236 __close_cached_connection(struct cached_connection_ *connection) in __close_cached_connection() argument
238 assert(connection != NULL); in __close_cached_connection()
240 _close(connection->sockfd); in __close_cached_connection()
241 _close(connection->read_queue); in __close_cached_connection()
242 _close(connection->write_queue); in __close_cached_connection()
243 free(connection); in __close_cached_connection()
252 __cached_write(struct cached_connection_ *connection, const char *entry_name, in __cached_write() argument
261 result = send_credentials(connection, CET_WRITE_REQUEST); in __cached_write()
266 result = safe_write(connection, &name_size, sizeof(size_t)); in __cached_write()
270 result = safe_write(connection, &key_size, sizeof(size_t)); in __cached_write()
274 result = safe_write(connection, &data_size, sizeof(size_t)); in __cached_write()
278 result = safe_write(connection, entry_name, name_size); in __cached_write()
282 result = safe_write(connection, key, key_size); in __cached_write()
286 result = safe_write(connection, data, data_size); in __cached_write()
290 result = safe_read(connection, &error_code, sizeof(int)); in __cached_write()
304 __cached_read(struct cached_connection_ *connection, const char *entry_name, in __cached_read() argument
311 assert(connection != NULL); in __cached_read()
315 result = send_credentials(connection, CET_READ_REQUEST); in __cached_read()
320 result = safe_write(connection, &name_size, sizeof(size_t)); in __cached_read()
324 result = safe_write(connection, &key_size, sizeof(size_t)); in __cached_read()
328 result = safe_write(connection, entry_name, name_size); in __cached_read()
332 result = safe_write(connection, key, key_size); in __cached_read()
336 result = safe_read(connection, &rec_error_code, sizeof(int)); in __cached_read()
345 result = safe_read(connection, &result_size, sizeof(size_t)); in __cached_read()
355 result = safe_read(connection, data, result_size); in __cached_read()
367 * Initializes the mp_write_session. For such a session the new connection
377 struct cached_connection_ *connection, *retval; in __open_cached_mp_write_session() local
383 connection = __open_cached_connection(params); in __open_cached_mp_write_session()
384 if (connection == NULL) in __open_cached_mp_write_session()
386 connection->mp_flag = 1; in __open_cached_mp_write_session()
388 result = send_credentials(connection, CET_MP_WRITE_SESSION_REQUEST); in __open_cached_mp_write_session()
393 result = safe_write(connection, &name_size, sizeof(size_t)); in __open_cached_mp_write_session()
397 result = safe_write(connection, entry_name, name_size); in __open_cached_mp_write_session()
401 result = safe_read(connection, &error_code, sizeof(int)); in __open_cached_mp_write_session()
410 __close_cached_connection(connection); in __open_cached_mp_write_session()
412 retval = connection; in __open_cached_mp_write_session()
484 struct cached_connection_ *connection, *retval; in __open_cached_mp_read_session() local
490 connection = __open_cached_connection(params); in __open_cached_mp_read_session()
491 if (connection == NULL) in __open_cached_mp_read_session()
493 connection->mp_flag = 1; in __open_cached_mp_read_session()
495 result = send_credentials(connection, CET_MP_READ_SESSION_REQUEST); in __open_cached_mp_read_session()
500 result = safe_write(connection, &name_size, sizeof(size_t)); in __open_cached_mp_read_session()
504 result = safe_write(connection, entry_name, name_size); in __open_cached_mp_read_session()
508 result = safe_read(connection, &error_code, sizeof(int)); in __open_cached_mp_read_session()
517 __close_cached_connection(connection); in __open_cached_mp_read_session()
519 retval = connection; in __open_cached_mp_read_session()