race in connection state when setting a handler on a different thread

Former-commit-id: 42c7677690c434168135992429f7521239475ef8
This commit is contained in:
John Sully 2020-05-24 02:45:11 -04:00
parent d3bd1ab56b
commit 0dd0ea7eda

View File

@ -31,6 +31,8 @@
#ifndef __REDIS_CONNECTION_H #ifndef __REDIS_CONNECTION_H
#define __REDIS_CONNECTION_H #define __REDIS_CONNECTION_H
#include <atomic>
#define CONN_INFO_LEN 32 #define CONN_INFO_LEN 32
struct aeEventLoop; struct aeEventLoop;
@ -70,7 +72,7 @@ typedef struct ConnectionType {
struct connection { struct connection {
ConnectionType *type; ConnectionType *type;
ConnectionState state; std::atomic<ConnectionState> state;
short int flags; short int flags;
short int refs; short int refs;
int last_errno; int last_errno;