Skip to content

Commit

Permalink
Draft 0.1
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
benjiam committed Oct 21, 2014
1 parent 6c80fc1 commit 5752c77
Show file tree
Hide file tree
Showing 25 changed files with 1,275 additions and 0 deletions.
47 changes: 47 additions & 0 deletions code/cppserver/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
# BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerBindsToType: false
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: false
Standard: Cpp03
IndentWidth: 2
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Attach
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
...

59 changes: 59 additions & 0 deletions code/cppserver/Debug/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: Server

# Tool invocations
Server: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -o "Server" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '

# Other Targets
clean:
-$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) Server
-@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets
8 changes: 8 additions & 0 deletions code/cppserver/Debug/objects.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

USER_OBJS :=

LIBS := -lpthread

27 changes: 27 additions & 0 deletions code/cppserver/Debug/sources.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

O_SRCS :=
CPP_SRCS :=
C_UPPER_SRCS :=
C_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
CXX_SRCS :=
C++_SRCS :=
CC_SRCS :=
OBJS :=
C++_DEPS :=
C_DEPS :=
CC_DEPS :=
CPP_DEPS :=
EXECUTABLES :=
CXX_DEPS :=
C_UPPER_DEPS :=

# Every subdirectory with source files must be described here
SUBDIRS := \
src \

56 changes: 56 additions & 0 deletions code/cppserver/Debug/src/subdir.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/client.cc \
../src/network.cc \
../src/worker.cc

CC_SRCS += \
../src/listenfd.cc \
../src/main.cc \
../src/main_event.cc \
../src/socket_util.cc \
../src/timers.cc

OBJS += \
./src/client.o \
./src/listenfd.o \
./src/main.o \
./src/main_event.o \
./src/network.o \
./src/socket_util.o \
./src/timers.o \
./src/worker.o

CC_DEPS += \
./src/listenfd.d \
./src/main.d \
./src/main_event.d \
./src/socket_util.d \
./src/timers.d

CPP_DEPS += \
./src/client.d \
./src/network.d \
./src/worker.d


# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.cc
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '

src/%.o: ../src/%.cc
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '


59 changes: 59 additions & 0 deletions code/cppserver/Release/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: Server

# Tool invocations
Server: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -o "Server" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '

# Other Targets
clean:
-$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) Server
-@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets
8 changes: 8 additions & 0 deletions code/cppserver/Release/objects.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

USER_OBJS :=

LIBS := -lpthread

27 changes: 27 additions & 0 deletions code/cppserver/Release/sources.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

O_SRCS :=
CPP_SRCS :=
C_UPPER_SRCS :=
C_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
CXX_SRCS :=
C++_SRCS :=
CC_SRCS :=
OBJS :=
C++_DEPS :=
C_DEPS :=
CC_DEPS :=
CPP_DEPS :=
EXECUTABLES :=
CXX_DEPS :=
C_UPPER_DEPS :=

# Every subdirectory with source files must be described here
SUBDIRS := \
src \

56 changes: 56 additions & 0 deletions code/cppserver/Release/src/subdir.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/client.cc \
../src/network.cc \
../src/worker.cc

CC_SRCS += \
../src/listenfd.cc \
../src/main.cc \
../src/main_event.cc \
../src/socket_util.cc \
../src/timers.cc

OBJS += \
./src/client.o \
./src/listenfd.o \
./src/main.o \
./src/main_event.o \
./src/network.o \
./src/socket_util.o \
./src/timers.o \
./src/worker.o

CC_DEPS += \
./src/listenfd.d \
./src/main.d \
./src/main_event.d \
./src/socket_util.d \
./src/timers.d

CPP_DEPS += \
./src/client.d \
./src/network.d \
./src/worker.d


# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.cc
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '

src/%.o: ../src/%.cc
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '


6 changes: 6 additions & 0 deletions code/cppserver/doc/protocol.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


设计很简单 支持 1M 的连接, 可以准时向客户端推送数据。



Empty file.
Loading

0 comments on commit 5752c77

Please sign in to comment.