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

C++ MHD_stop_daemon函数代码示例

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

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



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

示例1: test_cipher_option

static int
test_cipher_option (FILE * test_fd,
		    const char *cipher_suite,
		    int proto_version)
{

  int ret;
  struct MHD_Daemon *d;
  d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_TLS |
                        MHD_USE_DEBUG, 4233,
                        NULL, NULL, &http_ahc, NULL,
                        MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
                        MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
                        MHD_OPTION_END);

  if (d == NULL)
    {
      fprintf (stderr, MHD_E_SERVER_INIT);
      return -1;
    }

  ret = test_https_transfer (test_fd, cipher_suite, proto_version);

  MHD_stop_daemon (d);
  return ret;
}
开发者ID:svn2github,项目名称:libmicrohttpd,代码行数:26,代码来源:test_https_get.c


示例2: MHD_stop_daemon

void ApiServerMHD::stop()
{
    if(mDaemon == 0)
        return;
    MHD_stop_daemon(mDaemon);
    mDaemon = 0;
}
开发者ID:N00D13,项目名称:RetroShare,代码行数:7,代码来源:ApiServerMHD.cpp


示例3: testLongUrlGet

static int
testLongUrlGet ()
{
    struct MHD_Daemon *d;
    CURL *c;
    char buf[2048];
    struct CBC cbc;
    char *url;
    int i;

    cbc.buf = buf;
    cbc.size = 2048;
    cbc.pos = 0;
    d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ ,
                          11080,
                          &apc_all,
                          NULL,
                          &ahc_echo,
                          "GET",
                          MHD_OPTION_CONNECTION_MEMORY_LIMIT,
                          (size_t) (VERY_LONG / 2), MHD_OPTION_END);

    if (d == NULL)
        return 1;
    zzuf_socat_start ();
    for (i = 0; i < LOOP_COUNT; i++)
    {
        fprintf (stderr, ".");

        c = curl_easy_init ();
        url = malloc (VERY_LONG);
        memset (url, 'a', VERY_LONG);
        url[VERY_LONG - 1] = '\0';
        memcpy (url, "http://localhost:11081/",
                strlen ("http://localhost:11081/"));
        curl_easy_setopt (c, CURLOPT_URL, url);
        curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
        curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
        curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
        curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT);
        curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT);
        if (oneone)
            curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
        else
            curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
        // NOTE: use of CONNECTTIMEOUT without also
        //   setting NOSIGNAL results in really weird
        //   crashes on my system!
        curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
        curl_easy_perform (c);
        curl_easy_cleanup (c);
    }
    fprintf (stderr, "\n");
    zzuf_socat_stop ();

    MHD_stop_daemon (d);
    free (url);
    return 0;
}
开发者ID:Karlson2k,项目名称:libmicrohttpd,代码行数:59,代码来源:test_long_header.c


示例4: MHD_stop_daemon

void MicroHttpd::stop()
{
	if(_d->mhd) {
		logger::info() << "stopping microhttpd";
		MHD_stop_daemon(_d->mhd);
		_d->mhd = 0;
	}
}
开发者ID:LionsPhil,项目名称:Drawpile,代码行数:8,代码来源:qmhttp.cpp


示例5: qInfo

void MicroHttpd::stop()
{
	if(_d->mhd) {
		qInfo("Stopping microhttpd");
		MHD_stop_daemon(_d->mhd);
		_d->mhd = 0;
	}
}
开发者ID:tokyogeometry,项目名称:Drawpile,代码行数:8,代码来源:qmhttp.cpp


示例6: test_ip_addr_option

/**
 * Test daemon initialization with the MHD_OPTION_SOCK_ADDR option
 */
static int
test_ip_addr_option ()
{
  struct MHD_Daemon *d;
  struct sockaddr_in daemon_ip_addr;
#if HAVE_INET6
  struct sockaddr_in6 daemon_ip_addr6;
#endif

  memset (&daemon_ip_addr, 0, sizeof (struct sockaddr_in));
  daemon_ip_addr.sin_family = AF_INET;
  daemon_ip_addr.sin_port = htons (42433);

#if HAVE_INET6
  memset (&daemon_ip_addr6, 0, sizeof (struct sockaddr_in6));
  daemon_ip_addr6.sin6_family = AF_INET6;
  daemon_ip_addr6.sin6_port = htons (42433);
#endif

  inet_pton (AF_INET, "127.0.0.1", &daemon_ip_addr.sin_addr);
#if HAVE_INET6
  inet_pton (AF_INET6, "::ffff:127.0.0.1", &daemon_ip_addr6.sin6_addr);
#endif

  d = MHD_start_daemon (MHD_USE_DEBUG, 42433,
                        NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR,
                        &daemon_ip_addr, MHD_OPTION_END);

  if (d == 0)
    return -1;

  MHD_stop_daemon (d);

#if HAVE_INET6
  d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_IPv6, 42433,
                        NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR,
                        &daemon_ip_addr6, MHD_OPTION_END);

  if (d == 0)
    return -1;

  MHD_stop_daemon (d);
#endif

  return 0;
}
开发者ID:1c0n,项目名称:xbmc,代码行数:49,代码来源:daemon_options_test.c


示例7: httpd_proc_destroy

void httpd_proc_destroy(void)
{
#ifdef LIBMICROHTTPD
	LM_DBG("destroying module ...\n");
	MHD_stop_daemon (dmn);
#endif
	return;
}
开发者ID:ZRouter,项目名称:ZRouter,代码行数:8,代码来源:httpd_proc.c


示例8: MHD_stop_daemon

bool CWebServer::Stop()
{
  if (!m_running)
    return true;

  if (m_daemon_ip6 != nullptr)
    MHD_stop_daemon(m_daemon_ip6);

  if (m_daemon_ip4 != nullptr)
    MHD_stop_daemon(m_daemon_ip4);

  m_running = false;
  CLog::Log(LOGNOTICE, "CWebServer[%hu]: Stopped", m_port);
  m_port = 0;

  return true;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:17,代码来源:WebServer.cpp


示例9: MHD_stop_daemon

Webserver::~Webserver ()
{
	if (wdata != NULL) {
		MHD_stop_daemon((MHD_Daemon *)wdata);
		wdata = NULL;
		ready = false;
	}
}
开发者ID:zombie9080,项目名称:libmicrohttpd-test,代码行数:8,代码来源:webserver.cpp


示例10: main

/**
 * Call with the port number as the only argument.
 * Never terminates (other than by signals, such as CTRL-C).
 */
int
main (int argc, char *const *argv)
{
  struct MHD_Daemon *d;
  struct timeval tv;
  struct timeval *tvp;
  fd_set rs;
  fd_set ws;
  fd_set es;
  int max;
  MHD_UNSIGNED_LONG_LONG mhd_timeout;

  if (argc != 2)
    {
      printf ("%s PORT\n", argv[0]);
      return 1;
    }
  /* initialize PRNG */
  srand ((unsigned int) time (NULL));
  d = MHD_start_daemon (MHD_USE_DEBUG,
                        atoi (argv[1]),
                        NULL, NULL, 
			&create_response, NULL, 
			MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
			MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL,
			MHD_OPTION_END);
  if (NULL == d)
    return 1;
  while (1)
    {
      expire_sessions ();
      max = 0;
      FD_ZERO (&rs);
      FD_ZERO (&ws);
      FD_ZERO (&es);
      if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
	break; /* fatal internal error */
      if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)	
	{
	  tv.tv_sec = mhd_timeout / 1000;
	  tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
	  tvp = &tv;	  
	}
      else
	tvp = NULL;
      if (-1 == select (max + 1, &rs, &ws, &es, tvp))
	{
	  if (EINTR != errno)
	    fprintf (stderr, 
		     "Aborting due to error during select: %s\n",
		     strerror (errno));
	  break;
	}
      MHD_run (d);
    }
  MHD_stop_daemon (d);
  return 0;
}
开发者ID:uplusplus,项目名称:libmicrohttpd,代码行数:62,代码来源:sessions.c


示例11: MHD_stop_daemon

/** Destructor. */
WebServer::~WebServer()
{
  MHD_stop_daemon(__daemon);
  __daemon = NULL;
  __dispatcher = NULL;

  if (__ssl_key_mem)   free(__ssl_key_mem);
  if (__ssl_cert_mem)  free(__ssl_cert_mem);
}
开发者ID:sanyaade-teachings,项目名称:fawkes,代码行数:10,代码来源:server.cpp


示例12: MHD_stop_daemon

bool CWebServer::Stop()
{
  if (m_running)
  {
    if (m_daemon_ip6 != NULL)
      MHD_stop_daemon(m_daemon_ip6);

    if (m_daemon_ip4 != NULL)
      MHD_stop_daemon(m_daemon_ip4);
    
    m_running = false;
    CLog::Log(LOGNOTICE, "WebServer: Stopped the webserver");
  }
  else 
    CLog::Log(LOGNOTICE, "WebServer: Stopped failed because its not running");

  return !m_running;
}
开发者ID:Karlson2k,项目名称:xbmc,代码行数:18,代码来源:WebServer.cpp


示例13: while

/**
* Stop the daemon
**/
CmdManager::~CmdManager()
{
    Cmd* c;
    while (work.trypop(c)) {
        c->cancel();
    }

    MHD_stop_daemon(daemon);
}
开发者ID:TheJosh,项目名称:chaotic-rage,代码行数:12,代码来源:cmd_manager.cpp


示例14: httpsrv_stop

void httpsrv_stop()
{
	if (!httpsrv)
		return;
	
	applog(LOG_DEBUG, "Stopping HTTP server");
	MHD_stop_daemon(httpsrv);
	httpsrv = NULL;
}
开发者ID:end18,项目名称:avalon,代码行数:9,代码来源:httpsrv.c


示例15: ServeOneRequest

static void *
ServeOneRequest(void *param)
{
    struct MHD_Daemon *d;
    fd_set rs;
    fd_set ws;
    fd_set es;
    MHD_socket fd, max;
    time_t start;
    struct timeval tv;
    int done = 0;

    fd = (MHD_socket) (intptr_t) param;

    d = MHD_start_daemon (MHD_USE_DEBUG,
                          1082, NULL, NULL, &ahc_echo, "GET",
                          MHD_OPTION_LISTEN_SOCKET, fd,
                          MHD_OPTION_NOTIFY_COMPLETED, &request_completed, &done,
                          MHD_OPTION_END);
    if (d == NULL)
        return "MHD_start_daemon() failed";

    start = time (NULL);
    while ((time (NULL) - start < 5) && done == 0)
    {
        max = 0;
        FD_ZERO (&rs);
        FD_ZERO (&ws);
        FD_ZERO (&es);
        if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
        {
            MHD_stop_daemon (d);
            MHD_socket_close_(fd);
            return "MHD_get_fdset() failed";
        }
        tv.tv_sec = 0;
        tv.tv_usec = 1000;
        MHD_SYS_select_ (max + 1, &rs, &ws, &es, &tv);
        MHD_run (d);
    }
    MHD_stop_daemon (d);
    MHD_socket_close_(fd);
    return NULL;
}
开发者ID:Paxxi,项目名称:xbmc-deps,代码行数:44,代码来源:test_quiesce.c


示例16: pthread_cancel

void DSPServer::stop()
{
    if (fDaemon) {
        // Faire un truc pour arrêter la boucle ?
        pthread_cancel(fThread);
        pthread_join(fThread, NULL);
        MHD_stop_daemon(fDaemon);
        fDaemon = 0;
    }
}
开发者ID:EBone,项目名称:Faust,代码行数:10,代码来源:remote_server.cpp


示例17: test_ip_addr_option

/**
 * Test daemon initialization with the MHD_OPTION_SOCK_ADDR option
 */
static int
test_ip_addr_option ()
{
  struct MHD_Daemon *d;
  struct sockaddr_in daemon_ip_addr;
#if HAVE_INET6
  struct sockaddr_in6 daemon_ip_addr6;
#endif

  memset (&daemon_ip_addr, 0, sizeof (struct sockaddr_in));
  daemon_ip_addr.sin_family = AF_INET;
  daemon_ip_addr.sin_port = htons (4233);
  daemon_ip_addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);

#if HAVE_INET6
  memset (&daemon_ip_addr6, 0, sizeof (struct sockaddr_in6));
  daemon_ip_addr6.sin6_family = AF_INET6;
  daemon_ip_addr6.sin6_port = htons (4233);
  daemon_ip_addr6.sin6_addr = in6addr_loopback;
#endif

  d = MHD_start_daemon (MHD_USE_DEBUG, 4233,
                        NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR,
                        &daemon_ip_addr, MHD_OPTION_END);

  if (d == 0)
    return -1;

  MHD_stop_daemon (d);

#if HAVE_INET6
  d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_IPv6, 4233,
                        NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR,
                        &daemon_ip_addr6, MHD_OPTION_END);

  if (d == 0)
    return -1;

  MHD_stop_daemon (d);
#endif

  return 0;
}
开发者ID:Chris112,项目名称:sep,代码行数:46,代码来源:test_options.c


示例18: MHD_stop_daemon

int HTTPServer::stop(){
	if(daemon != NULL){
	  MHD_stop_daemon (daemon);
	  Logging::getInstance()->Log(Logging::INFO, "MHD Daemon is stopped!");
	  return 1;
	}else{
	  Logging::getInstance()->Log(Logging::WARNING, "MHD Daemon is not stopped!");
		return 0;
	}
}
开发者ID:mnabaee,项目名称:bdcp,代码行数:10,代码来源:HTTPServer.cpp


示例19: stop_unsecure_server

/**
 * Stop the MHD web server and the AVAHI server and free the associated services
 *
 * @return A HPD error code
 */
int 
stop_unsecure_server()
{
	assert(d);

	free_unsecure_server_services();

	MHD_stop_daemon (d);

	return HPD_E_SUCCESS;
}
开发者ID:Rustor,项目名称:HomeAutomationBridgeZ,代码行数:16,代码来源:hpd_http_web_server.c


示例20: testMultithreadedGet

static int
testMultithreadedGet ()
{
  struct MHD_Daemon *d;
  CURL *c;
  char buf[2048];
  struct CBC cbc;
  CURLcode errornum;

  cbc.buf = buf;
  cbc.size = 2048;
  cbc.pos = 0;
  d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
                        1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
  if (d == NULL)
    return 16;
  c = curl_easy_init ();
  curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world");
  curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
  curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
  curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
  curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
  curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L);
  // NOTE: use of CONNECTTIMEOUT without also
  //   setting NOSIGNAL results in really weird
  //   crashes on my system!
  curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
  if (CURLE_OK != (errornum = curl_easy_perform (c)))
    {
      fprintf (stderr,
               "curl_easy_perform failed: `%s'\n",
               curl_easy_strerror (errornum));
      curl_easy_cleanup (c);
      MHD_stop_daemon (d);
      return 32;
    }
  curl_easy_cleanup (c);
  MHD_stop_daemon (d);
  return validate (cbc, 64);
}
开发者ID:dreamsxin,项目名称:golf,代码行数:41,代码来源:daemontest_get_chunked.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MHVTL_DBG函数代码示例发布时间:2022-05-30
下一篇:
C++ MHD_start_daemon函数代码示例发布时间: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