Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
007a8678
Commit
007a8678
authored
Sep 20, 2018
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use INVALID_SOCKET_ID instead of (SocketId)-1
parent
bef2eb80
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
channel.cpp
src/brpc/channel.cpp
+2
-2
selective_channel.cpp
src/brpc/selective_channel.cpp
+1
-1
socket_map.cpp
src/brpc/socket_map.cpp
+3
-3
No files found.
src/brpc/channel.cpp
View file @
007a8678
...
...
@@ -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
));
}
...
...
src/brpc/selective_channel.cpp
View file @
007a8678
...
...
@@ -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
();
...
...
src/brpc/socket_map.cpp
View file @
007a8678
...
...
@@ -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
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment