You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Lock the shared pointer to this. May be a nullptr, so we need to check!!!
186
+
auto me = weak_me.lock();
187
+
188
+
// Before even checking the error code, check if the server has been stopped
189
+
if (!me || (me->is_stopped_))
190
+
{
191
+
return;
192
+
}
193
+
194
+
// Check error code
176
195
if (ec)
177
196
{
178
197
if (ec != asio::error::operation_aborted)
@@ -187,8 +206,6 @@ namespace fineftp
187
206
#endif
188
207
// TODO: review if this is thread safe, if right here the ftp server is shut down and the acceptor is closed. I think, that then the session will still be added to the list of open sessions and kept open.
Copy file name to clipboardExpand all lines: fineftp-server/src/server_impl.h
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -54,10 +54,11 @@ namespace fineftp
54
54
voidwaitForNextFtpSession();
55
55
56
56
private:
57
-
UserDatabase ftp_users_;
57
+
UserDatabase ftp_users_;
58
58
59
-
constuint16_t port_;
60
-
const std::string address_;
59
+
constuint16_t port_; //! Port used on creation. May be 0. In that case, the OS will choose a port. Thus, this variable should not be used for getting the actual port.
60
+
const std::string address_; //! Address used on creation. The acceptor is bound to that address.
61
+
std::atomic<bool> is_stopped_; //! Tells whether the server has been stopped. When stopped, it will refuse to accept new connections.
0 commit comments