• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ensure_eventmachine函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: evma_start_tls

extern "C" void evma_start_tls (const unsigned long binding)
{
	ensure_eventmachine("evma_start_tls");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed)
		ed->StartTls();
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:7,代码来源:cmain.cpp


示例2: evma_set_tls_parms

extern "C" void evma_set_tls_parms (const unsigned long binding, const char *privatekey_filename, const char *certchain_filename, int verify_peer)
{
	ensure_eventmachine("evma_set_tls_parms");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed)
		ed->SetTlsParms (privatekey_filename, certchain_filename, (verify_peer == 1 ? true : false));
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:7,代码来源:cmain.cpp


示例3: evma_start_proxy

extern "C" void evma_start_proxy (const unsigned long from, const unsigned long to, const unsigned long bufsize)
{
	ensure_eventmachine("evma_start_proxy");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (from));
	if (ed)
		ed->StartProxy(to, bufsize);
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:7,代码来源:cmain.cpp


示例4: evma_accept_ssl_peer

extern "C" void evma_accept_ssl_peer (const unsigned long binding)
{
	ensure_eventmachine("evma_accept_ssl_peer");
	ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject (binding));
	if (cd)
		cd->AcceptSslPeer();
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:7,代码来源:cmain.cpp


示例5: evma_close_connection

extern "C" void evma_close_connection (const unsigned long binding, int after_writing)
{
	ensure_eventmachine("evma_close_connection");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed)
		ed->ScheduleClose (after_writing ? true : false);
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:7,代码来源:cmain.cpp


示例6: evma_stop_proxy

extern "C" void evma_stop_proxy (const unsigned long from)
{
	ensure_eventmachine("evma_stop_proxy");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (from));
	if (ed)
		ed->StopProxy();
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:7,代码来源:cmain.cpp


示例7: evma_send_file_data_to_connection

extern "C" int evma_send_file_data_to_connection (const unsigned long binding, const char *filename)
{
	/* This is a sugaring over send_data_to_connection that reads a file into a
	 * locally-allocated buffer, and sends the file data to the remote peer.
	 * Return the number of bytes written to the caller.
	 * TODO, needs to impose a limit on the file size. This is intended only for
	 * small files. (I don't know, maybe 8K or less.) For larger files, use interleaved
	 * I/O to avoid slowing the rest of the system down.
	 * TODO: we should return a code rather than barf, in case of file-not-found.
	 * TODO, does this compile on Windows?
	 * TODO, given that we want this to work only with small files, how about allocating
	 * the buffer on the stack rather than the heap?
	 *
	 * Modified 25Jul07. This now returns -1 on file-too-large; 0 for success, and a positive
	 * errno in case of other errors.
	 *
	 * Contributed by Kirk Haines.
	 */

	char data[32*1024];
	int r;

	ensure_eventmachine("evma_send_file_data_to_connection");

	int Fd = open (filename, O_RDONLY);

	if (Fd < 0)
		return errno;
	// From here on, all early returns MUST close Fd.

	struct stat st;
	if (fstat (Fd, &st)) {
		int e = errno;
		close (Fd);
		return e;
	}

	off_t filesize = st.st_size;
	if (filesize <= 0) {
		close (Fd);
		return 0;
	}
	else if (filesize > (off_t) sizeof(data)) {
		close (Fd);
		return -1;
	}


	r = read (Fd, data, filesize);
	if (r != filesize) {
		int e = errno;
		close (Fd);
		return e;
	}
	evma_send_data_to_connection (binding, data, r);
	close (Fd);

	return 0;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:59,代码来源:cmain.cpp


示例8: ensure_eventmachine

extern "C" X509 *evma_get_peer_cert (const unsigned long binding)
{
	ensure_eventmachine("evma_get_peer_cert");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed)
		return ed->GetPeerCert();
	return NULL;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:8,代码来源:cmain.cpp


示例9: evma_report_connection_error_status

extern "C" int evma_report_connection_error_status (const unsigned long binding)
{
	ensure_eventmachine("evma_report_connection_error_status");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed)
		return ed->ReportErrorStatus();
	return -1;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:8,代码来源:cmain.cpp


示例10: evma_send_datagram

extern "C" int evma_send_datagram (const unsigned long binding, const char *data, int data_length, const char *address, int port)
{
	ensure_eventmachine("evma_send_datagram");
	DatagramDescriptor *dd = dynamic_cast <DatagramDescriptor*> (Bindable_t::GetObject (binding));
	if (dd)
		return dd->SendOutboundDatagram(data, data_length, address, port);
	return -1;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:8,代码来源:cmain.cpp


示例11: evma_send_data_to_connection

extern "C" int evma_send_data_to_connection (const unsigned long binding, const char *data, int data_length)
{
	ensure_eventmachine("evma_send_data_to_connection");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed)
		return ed->SendOutboundData(data, data_length);
	return -1;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:8,代码来源:cmain.cpp


示例12: evma_proxied_bytes

extern "C" unsigned long evma_proxied_bytes (const unsigned long from)
{
    ensure_eventmachine("evma_proxied_bytes");
    EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (from));
    if (ed)
        return ed->GetProxiedBytes();
    else
        return 0;
}
开发者ID:bhicks,项目名称:EventMachine-LE,代码行数:9,代码来源:cmain.cpp


示例13: evma_get_last_activity_time

extern "C" uint64_t evma_get_last_activity_time(const unsigned long from)
{
    ensure_eventmachine("evma_get_last_activity_time");
    EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (from));
    if (ed)
        return ed->GetLastActivity();
    else
        return 0;
}
开发者ID:bhicks,项目名称:EventMachine-LE,代码行数:9,代码来源:cmain.cpp


示例14: evma_set_comm_inactivity_timeout

extern "C" int evma_set_comm_inactivity_timeout (const unsigned long binding, float value)
{
	ensure_eventmachine("evma_set_comm_inactivity_timeout");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed) {
		return ed->SetCommInactivityTimeout ((uint64_t)(value * 1000));
	}
	else
		return 0; //Perhaps this should be an exception. Access to an unknown binding.
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:10,代码来源:cmain.cpp


示例15: evma_get_subprocess_status

extern "C" int evma_get_subprocess_status (const unsigned long binding, int *status)
{
	ensure_eventmachine("evma_get_subprocess_status");
	if (status) {
		*status = EventMachine->SubprocessExitStatus;
		return 1;
	}
	else
		return 0;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:10,代码来源:cmain.cpp


示例16: evma_get_sockname

extern "C" int evma_get_sockname (const unsigned long binding, struct sockaddr *sa)
{
	ensure_eventmachine("evma_get_sockname");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed) {
		return ed->GetSockname (sa) ? 1 : 0;
	}
	else
		return 0;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:10,代码来源:cmain.cpp


示例17: evma_get_pending_connect_timeout

extern "C" float evma_get_pending_connect_timeout (const unsigned long binding)
{
	ensure_eventmachine("evma_get_pending_connect_timeout");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed) {
		return ((float)ed->GetPendingConnectTimeout() / 1000);
	}
	else
		return 0.0;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:10,代码来源:cmain.cpp


示例18: evma_set_pending_connect_timeout

extern "C" int evma_set_pending_connect_timeout (const unsigned long binding, float value)
{
	ensure_eventmachine("evma_set_pending_connect_timeout");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed) {
		return ed->SetPendingConnectTimeout ((uint64_t)(value * 1000));
	}
	else
		return 0;
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:10,代码来源:cmain.cpp


示例19: evma_get_comm_inactivity_timeout

extern "C" float evma_get_comm_inactivity_timeout (const unsigned long binding)
{
	ensure_eventmachine("evma_get_comm_inactivity_timeout");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed) {
		return ((float)ed->GetCommInactivityTimeout() / 1000);
	}
	else
		return 0.0; //Perhaps this should be an exception. Access to an unknown binding.
}
开发者ID:mrkn,项目名称:eventmachine,代码行数:10,代码来源:cmain.cpp


示例20: evma_get_file_descriptor

extern "C" int evma_get_file_descriptor (const unsigned long binding)
{
	ensure_eventmachine("evma_get_file_descriptor");
	EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding));
	if (ed)
		return ed->GetSocket();
	else
		#ifdef BUILD_FOR_RUBY
			rb_raise(rb_eRuntimeError, "invalid binding to get_fd");
		#else
			throw std::runtime_error ("invalid binding to get_fd");
		#endif
}
开发者ID:snaury,项目名称:eventmachine,代码行数:13,代码来源:cmain.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ensure_path_unmounted函数代码示例发布时间:2022-05-30
下一篇:
C++ ensure_equals函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap