From f369e5e8f6171bd9c94f558c44b29188bfb437bd Mon Sep 17 00:00:00 2001 From: Salvatore Dipietro Date: Wed, 11 Jan 2023 09:27:43 -0800 Subject: [PATCH 1/2] compiling on aarch64 --- pink/Makefile | 13 ++++++++++--- pink/examples/Makefile | 9 ++++++++- pink/include/pink_conn.h | 2 +- pink/src/redis_conn.cc | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pink/Makefile b/pink/Makefile index 86c10a71..4444c235 100644 --- a/pink/Makefile +++ b/pink/Makefile @@ -1,7 +1,14 @@ CLEAN_FILES = # deliberately empty, so we can append below. -CXX=g++ -LDFLAGS= -lpthread -lrt -CXXFLAGS= -g -std=c++11 -fno-builtin-memcmp -msse -msse4.2 -pipe -fPIC +CXX?=g++ +LDFLAGS+= -lpthread -lrt +CXXFLAGS= -g -std=c++11 -fno-builtin-memcmp -pipe -fPIC +ARCH:=$(shell uname -p) +ifeq ($(ARCH), aarch64) + CXXFLAGS+=-march=armv8-a+crc+crypto -moutline-atomics +endif +ifeq ($(ARCH), x86_64) + CXXFLAGS+=-msse -msse4.2 +endif PROFILING_FLAGS=-pg ARFLAGS = rs OPT= diff --git a/pink/examples/Makefile b/pink/examples/Makefile index f9486ca7..d207bc9b 100644 --- a/pink/examples/Makefile +++ b/pink/examples/Makefile @@ -1,6 +1,13 @@ CXX=g++ LDFLAGS= -lpthread -lrt -lprotobuf -CXXFLAGS=-O2 -std=c++11 -fno-builtin-memcmp -msse -msse4.2 +CXXFLAGS=-O2 -std=c++11 -fno-builtin-memcmp +ARCH:=$(shell uname -p) +ifeq ($(ARCH), aarch64) + CXXFLAGS+=-march=armv8-a+crc+crypto -moutline-atomics +endif +ifeq ($(ARCH), x86_64) + CXXFLAGS+=-msse -msse4.2 +endif .PHONY: clean all diff --git a/pink/include/pink_conn.h b/pink/include/pink_conn.h index 5f2aa936..b93fcff9 100644 --- a/pink/include/pink_conn.h +++ b/pink/include/pink_conn.h @@ -118,7 +118,7 @@ class PinkConn : public std::enable_shared_from_this { std::string ip_port_; bool is_reply_; bool is_writable_; - bool close_; + bool close_{false}; struct timeval last_interaction_; int flags_; diff --git a/pink/src/redis_conn.cc b/pink/src/redis_conn.cc index 67e5e110..8fbace50 100644 --- a/pink/src/redis_conn.cc +++ b/pink/src/redis_conn.cc @@ -157,7 +157,7 @@ WriteStatus RedisConn::SendReply() { } } if (nwritten == -1) { - if (errno == EAGAIN) { + if (errno == EAGAIN || errno == EWOULDBLOCK) { return kWriteHalf; } else { // Here we should close the connection From f27c72be0a8aa5b566cbaa5495cd3868f47d8ee7 Mon Sep 17 00:00:00 2001 From: Salvatore Dipietro Date: Thu, 9 Feb 2023 18:50:58 +0000 Subject: [PATCH 2/2] initiation variables --- pink/include/pink_conn.h | 2 +- pink/src/pink_conn.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pink/include/pink_conn.h b/pink/include/pink_conn.h index b93fcff9..5f2aa936 100644 --- a/pink/include/pink_conn.h +++ b/pink/include/pink_conn.h @@ -118,7 +118,7 @@ class PinkConn : public std::enable_shared_from_this { std::string ip_port_; bool is_reply_; bool is_writable_; - bool close_{false}; + bool close_; struct timeval last_interaction_; int flags_; diff --git a/pink/src/pink_conn.cc b/pink/src/pink_conn.cc index 02b6d82d..ecc410d6 100644 --- a/pink/src/pink_conn.cc +++ b/pink/src/pink_conn.cc @@ -24,6 +24,9 @@ PinkConn::PinkConn(const int fd, ssl_(nullptr), #endif thread_(thread), + is_writable_(false), + close_(false), + flags_(1), pink_epoll_(pink_epoll) { gettimeofday(&last_interaction_, nullptr); }