当前位置: 首页>>代码示例>>C++>>正文


C++ BIO_set_retry_write函数代码示例

本文整理汇总了C++中BIO_set_retry_write函数的典型用法代码示例。如果您正苦于以下问题:C++ BIO_set_retry_write函数的具体用法?C++ BIO_set_retry_write怎么用?C++ BIO_set_retry_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BIO_set_retry_write函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tou_socket_write

static int tou_socket_write(BIO *b, const char *in, int inl)
	{
	int ret;
#ifdef DEBUG_TOU_BIO
	fprintf(stderr, "tou_socket_write(%p,%p,%d)\n",b,in,inl);
#endif
	
	clear_tou_socket_error(b->num);
	/* call tou library */
	ret=tou_write(b->num,in,inl);
	BIO_clear_retry_flags(b);
	if (ret <= 0)
		{
		if (BIO_tou_socket_should_retry(b->num,ret))
		{
			BIO_set_retry_write(b);
#ifdef DEBUG_TOU_BIO
			fprintf(stderr, "tou_socket_write() setting retry flag\n");
#endif
		}
		}
#ifdef DEBUG_TOU_BIO
	fprintf(stderr, "tou_socket_write() = %d\n", ret);
#endif
	return(ret);
	}
开发者ID:MrKID,项目名称:RetroShare,代码行数:26,代码来源:bss_tou.c

示例2: dgram_write

static int dgram_write(BIO *b, const char *in, int inl)
	{
	int ret;
	bio_dgram_data *data = (bio_dgram_data *)b->ptr;
	clear_socket_error();

    if ( data->connected )
        ret=writesocket(b->num,in,inl);
    else
#if defined(NETWARE_CLIB) && defined(NETWARE_BSDSOCK)
        ret=sendto(b->num, (char *)in, inl, 0, &data->peer, sizeof(data->peer));
#else
        ret=sendto(b->num, in, inl, 0, &data->peer, sizeof(data->peer));
#endif

	BIO_clear_retry_flags(b);
	if (ret <= 0)
		{
		if (BIO_sock_should_retry(ret))
			{
			BIO_set_retry_write(b);  
			data->_errno = get_last_socket_error();

#if 0 /* higher layers are responsible for querying MTU, if necessary */
			if ( data->_errno == EMSGSIZE)
				/* retrieve the new MTU */
				BIO_ctrl(b, BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL);
#endif
			}
		}
	return(ret);
	}
开发者ID:8003178550,项目名称:dsploit,代码行数:32,代码来源:bss_dgram.c

示例3: tlso_bio_write

static int
tlso_bio_write( BIO *b, const char *buf, int len )
{
	struct tls_data		*p;
	int			ret;
	
	if ( buf == NULL || len <= 0 ) return 0;
	
	p = (struct tls_data *)b->ptr;

	if ( p == NULL || p->sbiod == NULL ) {
		return 0;
	}

	ret = LBER_SBIOD_WRITE_NEXT( p->sbiod, (char *)buf, len );

	BIO_clear_retry_flags( b );
	if ( ret < 0 ) {
		int err = sock_errno();
		if ( err == EAGAIN || err == EWOULDBLOCK ) {
			BIO_set_retry_write( b );
		}
	}

	return ret;
}
开发者ID:cptaffe,项目名称:openldap,代码行数:26,代码来源:tls_o.c

示例4: memory_write

static int memory_write(BIO *b, const char *in, int inl)
{
	int ret = -1;
	char strBuffer[MAX_UDP_PACKET_SIZE];
	BIO_memory_data* pData = (BIO_memory_data*)b->ptr;
	
	//
	strBuffer[0] = (char)(CW_PROTOCOL_VERSION << 4) | (char)(CW_PACKET_CRYPT);
	strBuffer[1] = strBuffer[2] = strBuffer[3] = 0;

	//
	memcpy(&strBuffer[4], in, inl);

	//
	errno = 0;
	ret = sendto(pData->sock, strBuffer, inl + 4, 0, (struct sockaddr*)&pData->sendAddress, sizeof(struct sockaddr_storage));

	//BIO_clear_retry_flags(b);
	if (ret <= 0)
	{
		if (errno == EINTR)
			BIO_set_retry_write(b);  
	}
	else
	{
		ret -= 4;
	}
	
	return ret;
}
开发者ID:kernel-digger,项目名称:openCAPWAP,代码行数:30,代码来源:CWOpenSSLBio.c

示例5: _mongoc_stream_tls_bio_write

static int
_mongoc_stream_tls_bio_write (BIO        *b,
                              const char *buf,
                              int         len)
{
   mongoc_stream_tls_t *tls;
   mongoc_iovec_t iov;
   int ret;

   BSON_ASSERT (b);
   BSON_ASSERT (buf);

   if (!(tls = b->ptr)) {
      return -1;
   }

   iov.iov_base = (void *)buf;
   iov.iov_len = len;

   errno = 0;
   ret = (int)mongoc_stream_writev (tls->base_stream, &iov, 1,
                                    tls->timeout_msec);
   BIO_clear_retry_flags (b);

   if ((ret < 0) && MONGOC_ERRNO_IS_AGAIN (errno)) {
      BIO_set_retry_write (b);
   }

   return ret;
}
开发者ID:jeromelebel,项目名称:mongo-c-driver,代码行数:30,代码来源:mongoc-stream-tls.c

示例6: ACE_ASYNCH_BIO_WRITE_NAME

int
ACE_ASYNCH_BIO_WRITE_NAME (BIO * pBIO, const char * buf, int len)
{
  BIO_clear_retry_flags (pBIO);

  ACE_SSL_Asynch_Stream * p_stream =
    static_cast<ACE_SSL_Asynch_Stream *> (pBIO->ptr);

  if (pBIO->init == 0 || p_stream == 0 || buf == 0 || len <= 0)
    return -1;

  BIO_clear_retry_flags (pBIO);

  int errval = 0;

  int retval =
    ACE_SSL_Asynch_Stream_Accessor::write (p_stream,
                                           buf,
                                           len,
                                           errval);

  if (retval >= 0)
    return retval;

  if (errval == EINPROGRESS)
    BIO_set_retry_write (pBIO);

  return -1;
}
开发者ID:CCJY,项目名称:ACE,代码行数:29,代码来源:SSL_Asynch_BIO.cpp

示例7: ssl_write

static int ssl_write(BIO *bio, const char *out, int outl) {
  SSL *ssl = bio->ptr;
  if (ssl == NULL) {
    return 0;
  }

  BIO_clear_retry_flags(bio);

  const int ret = SSL_write(ssl, out, outl);

  switch (SSL_get_error(ssl, ret)) {
    case SSL_ERROR_WANT_WRITE:
      BIO_set_retry_write(bio);
      break;

    case SSL_ERROR_WANT_READ:
      BIO_set_retry_read(bio);
      break;

    case SSL_ERROR_WANT_CONNECT:
      BIO_set_retry_special(bio);
      bio->retry_reason = BIO_RR_CONNECT;
      break;

    case SSL_ERROR_NONE:
    case SSL_ERROR_SYSCALL:
    case SSL_ERROR_SSL:
    default:
      break;
  }

  return ret;
}
开发者ID:alagoutte,项目名称:proto-quic,代码行数:33,代码来源:bio_ssl.c

示例8: dgram_write

static int
dgram_write(BIO *b, const char *in, int inl)
{
	int ret;
	bio_dgram_data *data = (bio_dgram_data *)b->ptr;
	errno = 0;

	if (data->connected)
		ret = write(b->num, in, inl);
	else {
		int peerlen = sizeof(data->peer);

		if (data->peer.sa.sa_family == AF_INET)
			peerlen = sizeof(data->peer.sa_in);
		else if (data->peer.sa.sa_family == AF_INET6)
			peerlen = sizeof(data->peer.sa_in6);
		ret = sendto(b->num, in, inl, 0, &data->peer.sa, peerlen);
	}

	BIO_clear_retry_flags(b);
	if (ret <= 0) {
		if (BIO_dgram_should_retry(ret)) {
			BIO_set_retry_write(b);

			data->_errno = errno;
			/*
			 * higher layers are responsible for querying MTU,
			 * if necessary
			 */
		}
	}
	return (ret);
}
开发者ID:randombit,项目名称:hacrypto,代码行数:33,代码来源:bss_dgram.c

示例9: bio_bufferevent_write

/* Called to write data info the BIO */
static int
bio_bufferevent_write(BIO *b, const char *in, int inlen)
{
	struct bufferevent *bufev = BIO_get_data(b);
	struct evbuffer *output;
	size_t outlen;

	BIO_clear_retry_flags(b);

	if (!BIO_get_data(b))
		return -1;

	output = bufferevent_get_output(bufev);
	outlen = evbuffer_get_length(output);

	/* Copy only as much data onto the output buffer as can fit under the
	 * high-water mark. */
	if (bufev->wm_write.high && bufev->wm_write.high <= (outlen+inlen)) {
		if (bufev->wm_write.high <= outlen) {
			/* If no data can fit, we'll need to retry later. */
			BIO_set_retry_write(b);
			return -1;
		}
		inlen = bufev->wm_write.high - outlen;
	}

	EVUTIL_ASSERT(inlen > 0);
	evbuffer_add(output, in, inlen);
	return inlen;
}
开发者ID:CTSRD-CHERI,项目名称:cheribsd,代码行数:31,代码来源:bufferevent_openssl.c

示例10: tls_bio_mbuf_write

/** write to a mbuf.
 * (internal openssl use via the tls_mbuf method)
 * @return bytes written on success (0<= ret <=src_len), -1 on error or buffer
 * full (in this case sets should_retry_write).
 */
static int tls_bio_mbuf_write(BIO* b, const char* src, int src_len)
{
	struct tls_bio_mbuf_data* d;
	struct tls_mbuf* wr;
	int ret;

	ret = 0;
#if OPENSSL_VERSION_NUMBER < 0x010100000L
	d = b->ptr;
#else
	d = BIO_get_data(b);
#endif
	BIO_clear_retry_flags(b);
	if (unlikely(d == 0 || d->wr->buf == 0)) {
		if (d == 0)
			BUG("tls_BIO_mbuf %p: write called with null b->ptr\n", b);
		else {
			/* this form of calling write with a null buffer is used
			   as a shortcut when no data is available =>
			   simulate EAGAIN/WANT_WRITE */
			TLS_BIO_DBG("write (%p, %p, %d) called with null buffer"
					" => simulating WANT_WRITE\n", b, src, src_len);
			BIO_set_retry_write(b);
		}
		return -1;
	}
	wr = d->wr;
	if (unlikely(wr->size == wr->used && src_len)) {
		/* mimic non-blocking socket behaviour */
		TLS_BIO_DBG("write (%p, %p, %d) called with full wr buffer (%d)"
					" => simulating WANT_WRITE\n", b, src, src_len, wr->used);
		BIO_set_retry_write(b);
		return -1;
	}
	ret = MIN_int(wr->size - wr->used, src_len);
	memcpy(wr->buf + wr->used, src, ret);
	wr->used += ret;
/*	if (unlikely(ret < src_len))
		BIO_set_retry_write();
*/
	TLS_BIO_DBG("write called (%p, %p, %d) => %d\n", b, src, src_len, ret);
	return ret;
}
开发者ID:albertollamaso,项目名称:kamailio,代码行数:48,代码来源:tls_bio.c

示例11: fd_write

static int fd_write(BIO *b, const char *in, int inl) {
  int ret = write(b->num, in, inl);
  BIO_clear_retry_flags(b);
  if (ret <= 0) {
    if (bio_fd_should_retry(ret)) {
      BIO_set_retry_write(b);
    }
  }

  return ret;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:11,代码来源:fd.c

示例12: _goconn_bio_write

int _goconn_bio_write (BIO *bio, const char *buf, int len) {
  struct goconn_bio_write_return ret;
  ret = goconn_bio_write(bio, (char *) buf, len);

  BIO_clear_retry_flags(bio);
  if (ret.r0 == -1 && ret.r1 == EAGAIN) {
    BIO_set_retry_write(bio);
  }

  return ret.r0;
}
开发者ID:codemedic,项目名称:sslconn,代码行数:11,代码来源:conn.c

示例13: fd_write

static int fd_write(BIO *b, const char *in, int inl)
{
    int ret;
    clear_sys_error();
    ret = UP_write(b->num, in, inl);
    BIO_clear_retry_flags(b);
    if (ret <= 0) {
        if (BIO_fd_should_retry(ret))
            BIO_set_retry_write(b);
    }
    return (ret);
}
开发者ID:03050903,项目名称:godot,代码行数:12,代码来源:bss_fd.c

示例14: sock_write

static int sock_write(BIO *b, const char *in, int inl) {
  int ret;

  bio_clear_socket_error();
  ret = send(b->num, in, inl, 0);
  BIO_clear_retry_flags(b);
  if (ret <= 0) {
    if (bio_fd_should_retry(ret)) {
      BIO_set_retry_write(b);
    }
  }
  return ret;
}
开发者ID:xin3liang,项目名称:platform_external_chromium_org_third_party_boringssl_src,代码行数:13,代码来源:socket.c

示例15: sock_write

static int sock_write(BIO *b, const char *in, int inl)
{
    int ret;

    clear_socket_error();
    ret = writesocket(b->num, in, inl);
    BIO_clear_retry_flags(b);
    if (ret <= 0) {
        if (BIO_sock_should_retry(ret))
            BIO_set_retry_write(b);
    }
    return ret;
}
开发者ID:RTEMS,项目名称:rtems-libbsd,代码行数:13,代码来源:bss_sock.c


注:本文中的BIO_set_retry_write函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。