Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
e61c047c
Commit
e61c047c
authored
Aug 30, 2012
by
Dmitriy Vyukov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/rpc: protect serviceMap with RWMutex
R=r, r CC=golang-dev
https://golang.org/cl/6494044
parent
de13e8dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
server.go
src/pkg/net/rpc/server.go
+3
-3
No files found.
src/pkg/net/rpc/server.go
View file @
e61c047c
...
...
@@ -182,7 +182,7 @@ type Response struct {
// Server represents an RPC Server.
type
Server
struct
{
mu
sync
.
Mutex
// protects the serviceMap
mu
sync
.
RW
Mutex
// protects the serviceMap
serviceMap
map
[
string
]
*
service
reqLock
sync
.
Mutex
// protects freeReq
freeReq
*
Request
...
...
@@ -539,9 +539,9 @@ func (server *Server) readRequestHeader(codec ServerCodec) (service *service, mt
return
}
// Look up the request.
server
.
mu
.
Lock
()
server
.
mu
.
R
Lock
()
service
=
server
.
serviceMap
[
serviceMethod
[
0
]]
server
.
mu
.
Unlock
()
server
.
mu
.
R
Unlock
()
if
service
==
nil
{
err
=
errors
.
New
(
"rpc: can't find service "
+
req
.
ServiceMethod
)
return
...
...
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