Commit 007a8678 authored by gejun's avatar gejun

Use INVALID_SOCKET_ID instead of (SocketId)-1

parent bef2eb80
......@@ -126,7 +126,7 @@ static ChannelSignature ComputeChannelSignature(const ChannelOptions& opt) {
}
Channel::Channel(ProfilerLinker)
: _server_id((SocketId)-1)
: _server_id(INVALID_SOCKET_ID)
, _serialize_request(NULL)
, _pack_request(NULL)
, _get_method_name(NULL)
......@@ -134,7 +134,7 @@ Channel::Channel(ProfilerLinker)
}
Channel::~Channel() {
if (_server_id != (SocketId)-1) {
if (_server_id != INVALID_SOCKET_ID) {
const ChannelSignature sig = ComputeChannelSignature(_options);
SocketMapRemove(SocketMapKey(_server_address, sig));
}
......
......@@ -110,7 +110,7 @@ public:
explicit SubDone(Sender* owner)
: _owner(owner)
, _cid(INVALID_BTHREAD_ID)
, _peer_id((SocketId)-1) {
, _peer_id(INVALID_SOCKET_ID) {
}
~SubDone() {}
void Run();
......
......@@ -105,7 +105,7 @@ void SocketMapRemove(const SocketMapKey& key) {
// at NamingServiceThread is hard to be fixed right now. As long as
// FLAGS_health_check_interval is limited to positive, SocketMapInsert
// never replaces the sockets, skipping comparison is still right.
m->Remove(key, (SocketId)-1);
m->Remove(key, INVALID_SOCKET_ID);
}
}
......@@ -274,7 +274,7 @@ void SocketMap::RemoveInternal(const SocketMapKey& key,
return;
}
if (!remove_orphan &&
(expected_id == (SocketId)-1 || expected_id == sc->socket->id())) {
(expected_id == INVALID_SOCKET_ID || expected_id == sc->socket->id())) {
--sc->ref_count;
}
if (sc->ref_count == 0) {
......@@ -384,7 +384,7 @@ void SocketMap::WatchConnections() {
_options.defer_close_second;
ListOrphans(defer_seconds * 1000000L, &orphan_sockets);
for (size_t i = 0; i < orphan_sockets.size(); ++i) {
RemoveInternal(orphan_sockets[i], (SocketId)-1, true);
RemoveInternal(orphan_sockets[i], INVALID_SOCKET_ID, true);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment