bool hasLazyBaseSpecArg (BaseSpecPtr const & base_spec, util::String const & arg) { bool result = false; if (base_spec->isLazy ()) { LazyBaseSpec const & lazy_base_spec = static_cast <LazyBaseSpec const &> (* base_spec); gram::BlockVector const & arg_set = lazy_base_spec.getArgSet (); for (gram::BlockVectorConstIter beg = arg_set.begin (), end = arg_set.end (); beg != end; ++ beg) { if (beg->toString () == arg.c_str ()) { result = true; break; } } } return result; }
ResponseCode OpenSSLConnection::WriteInternal(const util::String &buf, size_t &size_written_bytes_out) { int error_code = 0; int select_retCode = -1; int cur_written_length = 0; size_t total_written_length = 0; ResponseCode rc = ResponseCode::SUCCESS; fd_set write_fds; size_t bytes_to_write = buf.length(); struct timeval timeout = {tls_write_timeout_.tv_sec, tls_write_timeout_.tv_usec}; do { cur_written_length = SSL_write(p_ssl_handle_, buf.c_str(), bytes_to_write); error_code = SSL_get_error(p_ssl_handle_, cur_written_length); if (0 < cur_written_length) { total_written_length += (size_t) cur_written_length; } else if (SSL_ERROR_WANT_WRITE == error_code) { FD_ZERO(&write_fds); FD_SET(server_tcp_socket_fd_, &write_fds); select_retCode = select(server_tcp_socket_fd_ + 1, NULL, &write_fds, NULL, &timeout); if (0 == select_retCode) { //0 == SELECT_TIMEOUT rc = ResponseCode::NETWORK_SSL_WRITE_TIMEOUT_ERROR; } else if (-1 == select_retCode) { //-1 == SELECT_TIMEOUT rc = ResponseCode::NETWORK_SSL_WRITE_ERROR; } } else { rc = ResponseCode::NETWORK_SSL_WRITE_ERROR; } } while (is_connected_ && ResponseCode::NETWORK_SSL_WRITE_ERROR != rc && ResponseCode::NETWORK_SSL_WRITE_TIMEOUT_ERROR != rc && total_written_length < bytes_to_write); if (ResponseCode::SUCCESS == rc) { size_written_bytes_out = total_written_length; } return rc; }