mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-02 03:47:53 +08:00
add fiber tests
This commit is contained in:
parent
b60bdf94cd
commit
87bb2ea18f
@ -107,6 +107,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server-threads", "lib_fiber
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "httpd", "lib_fiber\samples-c++1x\httpd\httpd.vcxproj", "{2F80A939-E4BD-4ED7-B512-95FC2B563009}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "httpc", "lib_fiber\samples-c++1x\httpc\httpc.vcxproj", "{2F80A939-E4BD-4ED7-B512-95FC2B563099}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
@ -381,6 +385,66 @@ Global
|
||||
{EE518BE5-94B2-4F8E-82CC-C08503BBD6B3}.Template|Win32.Build.0 = Debug|Win32
|
||||
{EE518BE5-94B2-4F8E-82CC-C08503BBD6B3}.Template|x64.ActiveCfg = Debug|x64
|
||||
{EE518BE5-94B2-4F8E-82CC-C08503BBD6B3}.Template|x64.Build.0 = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Debug|x64.Build.0 = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.DebugDll|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.DebugDll|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.DebugDll|Win32.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.DebugDll|Win32.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.DebugDll|x64.ActiveCfg = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.DebugDll|x64.Build.0 = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Release|Win32.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Release|x64.ActiveCfg = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Release|x64.Build.0 = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Releasedll|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Releasedll|Mixed Platforms.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Releasedll|Win32.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Releasedll|Win32.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Releasedll|x64.ActiveCfg = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Releasedll|x64.Build.0 = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Template|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Template|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Template|Win32.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Template|Win32.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Template|x64.ActiveCfg = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009}.Template|x64.Build.0 = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Debug|x64.Build.0 = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.DebugDll|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.DebugDll|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.DebugDll|Win32.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.DebugDll|Win32.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.DebugDll|x64.ActiveCfg = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.DebugDll|x64.Build.0 = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Release|Win32.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Release|x64.ActiveCfg = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Release|x64.Build.0 = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Releasedll|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Releasedll|Mixed Platforms.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Releasedll|Win32.ActiveCfg = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Releasedll|Win32.Build.0 = Release|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Releasedll|x64.ActiveCfg = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Releasedll|x64.Build.0 = Release|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Template|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Template|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Template|Win32.ActiveCfg = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Template|Win32.Build.0 = Debug|Win32
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Template|x64.ActiveCfg = Debug|x64
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099}.Template|x64.Build.0 = Debug|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -401,6 +465,8 @@ Global
|
||||
{30A882E6-CF13-494F-9132-CE15E040B9DE} = {1CB30F2E-2587-43E7-A3CF-787783FB6924}
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563036} = {FD628E34-FBB8-4C60-8176-B770EC631CD9}
|
||||
{EE518BE5-94B2-4F8E-82CC-C08503BBD6B3} = {FD628E34-FBB8-4C60-8176-B770EC631CD9}
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563009} = {FD628E34-FBB8-4C60-8176-B770EC631CD9}
|
||||
{2F80A939-E4BD-4ED7-B512-95FC2B563099} = {FD628E34-FBB8-4C60-8176-B770EC631CD9}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {40FA3A5B-123F-4EC0-9EEB-8A9C17BF573B}
|
||||
|
3
lib_fiber/samples-c++1x/httpc/Makefile
Normal file
3
lib_fiber/samples-c++1x/httpc/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
include ../Makefile_cpp.in
|
||||
CFLAGS += -std=c++11
|
||||
PROG = client
|
105
lib_fiber/samples-c++1x/httpc/httpc.cpp
Normal file
105
lib_fiber/samples-c++1x/httpc/httpc.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
#include "stdafx.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int start(const char* addr, int count) {
|
||||
int i;
|
||||
acl::string buf;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
acl::http_request req(addr);
|
||||
acl::http_header& head = req.request_header();
|
||||
head.set_url("/")
|
||||
.accept_gzip(false)
|
||||
.set_host(addr)
|
||||
.set_keep_alive(false);
|
||||
|
||||
if (!req.request(NULL, 0)) {
|
||||
printf("request error\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!req.get_body(buf)) {
|
||||
printf("get response error\r\n");
|
||||
break;
|
||||
}
|
||||
if (i == 0) {
|
||||
printf("response: %s\r\n", buf.c_str());
|
||||
}
|
||||
buf.clear();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void usage(const char* procname) {
|
||||
printf("usage: %s -h [help]\r\n"
|
||||
" -e event_type[kernel|select|poll, default: kernel]\r\n"
|
||||
" -s server_addr[default: 127.0.0.1:9000]\r\n"
|
||||
" -c fiber_count[default: 1]\r\n"
|
||||
" -n count[default: 100]\r\n"
|
||||
, procname);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ch, nfiber = 1, count = 100;
|
||||
acl::string addr = "127.0.0.1:8088", event_type("kernel");
|
||||
|
||||
acl::acl_cpp_init();
|
||||
acl::log::stdout_open(true);
|
||||
|
||||
while ((ch = getopt(argc, argv, "he:s:c:n:")) > 0) {
|
||||
switch (ch) {
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
case 'e':
|
||||
event_type = optarg;
|
||||
break;
|
||||
case 's':
|
||||
addr = optarg;
|
||||
break;
|
||||
case 'c':
|
||||
nfiber = atoi(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
count = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
acl::fiber_event_t type;
|
||||
|
||||
if (event_type == "select") {
|
||||
type = acl::FIBER_EVENT_T_SELECT;
|
||||
} else if (event_type == "poll") {
|
||||
type = acl::FIBER_EVENT_T_POLL;
|
||||
} else {
|
||||
type = acl::FIBER_EVENT_T_KERNEL;
|
||||
}
|
||||
|
||||
long long total = 0;
|
||||
|
||||
struct timeval begin;
|
||||
gettimeofday(&begin, NULL);
|
||||
|
||||
for (int i = 0; i < nfiber; i++) {
|
||||
go[&] {
|
||||
total += start(addr, count);
|
||||
};
|
||||
}
|
||||
|
||||
acl::fiber::schedule_with(type);
|
||||
|
||||
struct timeval end;
|
||||
gettimeofday(&end, NULL);
|
||||
double cost = acl::stamp_sub(end, begin);
|
||||
printf("Total count=%lld, cost=%.2f ms, speed=%.2f\r\n",
|
||||
total, cost, (total * 1000) / (cost > 0 ? cost : 0.1));
|
||||
return 0;
|
||||
}
|
162
lib_fiber/samples-c++1x/httpc/httpc.vcxproj
Normal file
162
lib_fiber/samples-c++1x/httpc/httpc.vcxproj
Normal file
@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{2f80a939-e4bd-4ed7-b512-95fc2b563099}</ProjectGuid>
|
||||
<RootNamespace>httpc</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="httpc.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
27
lib_fiber/samples-c++1x/httpc/httpc.vcxproj.filters
Normal file
27
lib_fiber/samples-c++1x/httpc/httpc.vcxproj.filters
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2F2}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="httpc.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
1
lib_fiber/samples-c++1x/httpc/stdafx.cpp
Normal file
1
lib_fiber/samples-c++1x/httpc/stdafx.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "stdafx.h"
|
17
lib_fiber/samples-c++1x/httpc/stdafx.h
Normal file
17
lib_fiber/samples-c++1x/httpc/stdafx.h
Normal file
@ -0,0 +1,17 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是常用但不常更改的项目特定的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
// TODO: 在此处引用程序要求的附加头文件
|
||||
|
||||
#include "lib_acl.h"
|
||||
#include "acl_cpp/lib_acl.hpp"
|
||||
#include "fiber/fiber.hpp"
|
||||
#include "fiber/go_fiber.hpp"
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
159
lib_fiber/samples-c++1x/httpd/httpd.vcxproj
Normal file
159
lib_fiber/samples-c++1x/httpd/httpd.vcxproj
Normal file
@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{2f80a939-e4bd-4ed7-b512-95fc2b563009}</ProjectGuid>
|
||||
<RootNamespace>httpd</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\;..\..\c\include;..\..\cpp\include;..\..\..\lib_acl\include;..\..\..\lib_acl_cpp\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libfiber.lib;libfiber_cpp.lib;lib_acl.lib;lib_protocol.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
22
lib_fiber/samples-c++1x/httpd/httpd.vcxproj.filters
Normal file
22
lib_fiber/samples-c++1x/httpd/httpd.vcxproj.filters
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FE}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,4 +1,3 @@
|
||||
#include <getopt.h>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
@ -102,8 +101,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// start the server in alone or daemon mode
|
||||
|
||||
if (argc >= 2 && strcasecmp(argv[1], "alone") == 0) {
|
||||
const char* addr = "0.0.0.0|8194";
|
||||
if (argc >= 2 && strcmp(argv[1], "alone") == 0) {
|
||||
const char* addr = "0.0.0.0|8088";
|
||||
const char* conf = argc >= 3 ? argv[2] : NULL;
|
||||
|
||||
// run in alone mode
|
||||
|
Loading…
Reference in New Issue
Block a user