Skip to content

Commit 76ea146

Browse files
committed
Refactor isStopRequested method in TCPSocket class
Move the isStopRequested method from private to protected access, maintaining its functionality to check for a deliberate disconnect state. This change enhances the clarity of the class structure and allows for potential subclass usage.
1 parent 34acc54 commit 76ea146

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

include/ur_client_library/comm/tcp_socket.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ class TCPSocket
5959

6060
void setupOptions();
6161

62-
// True while a deliberate disconnect() is in progress or has completed (the "deliberate-stop
63-
// set"). The connect/retry machinery checks this to abort, and never overwrites these states,
64-
// so a teardown disconnect() that races a reconnect attempt is observed reliably.
65-
bool isStopRequested() const
66-
{
67-
const SocketState s = state_.load();
68-
return s == SocketState::Disconnecting || s == SocketState::Disconnected;
69-
}
70-
7162
// Atomically moves state_ to `desired`, unless a deliberate disconnect() (Disconnecting or
7263
// Disconnected) is in effect. Returns true if the state was set, false if a deliberate stop is
7364
// active (in which case state_ is left untouched). This is how the connect/retry machinery
@@ -81,6 +72,15 @@ class TCPSocket
8172
bool openInterruptible(socket_t socket_fd, struct sockaddr* address, size_t address_len);
8273

8374
protected:
75+
// True while a deliberate disconnect() is in progress or has completed (the "deliberate-stop
76+
// set"). The connect/retry machinery checks this to abort, and never overwrites these states,
77+
// so a teardown disconnect() that races a reconnect attempt is observed reliably.
78+
bool isStopRequested() const
79+
{
80+
const SocketState s = state_.load();
81+
return s == SocketState::Disconnecting || s == SocketState::Disconnected;
82+
}
83+
8484
static bool open(socket_t socket_fd, struct sockaddr* address, size_t address_len)
8585
{
8686
return ::connect(socket_fd, address, static_cast<socklen_t>(address_len)) == 0;

0 commit comments

Comments
 (0)