Skip to content

Commit 1572b27

Browse files
committed
change to std::unique_ptr
1 parent 8275d18 commit 1572b27

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Context.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ void Context::init()
1717
OVERLAPPED::OffsetHigh = 0;
1818

1919
_contextType = ContextType::None;
20-
21-
if (acceptSocket == nullptr)
22-
acceptSocket = std::make_unique<Socket>(Protocol::Tcp);
2320
}
2421

2522
Context::~Context()

src/Socket.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ bool Socket::accept(Context *context) const {
134134
context->init();
135135

136136
context->_contextType = ContextType::Accept;
137+
if (context->acceptSocket == nullptr)
138+
context->acceptSocket = std::make_unique<Socket>(Protocol::Tcp);
139+
137140
ioSystem.push(context->acceptSocket->_sock);
138141

139142
DWORD dwByte = 0;

0 commit comments

Comments
 (0)