Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs733
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sushant Mahajan
cs733
Commits
82832129
Commit
82832129
authored
Apr 18, 2015
by
Sushant Mahajan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed too many open files error, by defering rpc connection close on client side
parent
3a1eedef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
15 deletions
+2
-15
assignment4/src/raft/raft.go
assignment4/src/raft/raft.go
+2
-15
No files found.
assignment4/src/raft/raft.go
View file @
82832129
...
@@ -422,25 +422,11 @@ func (rft *Raft) handleAppendReply(temp *AppendReply) {
...
@@ -422,25 +422,11 @@ func (rft *Raft) handleAppendReply(temp *AppendReply) {
}
}
}
}
func
doAppendReplyRPC
(
hostname
string
,
logPort
int
,
temp
*
AppendReply
,
Info
*
log
.
Logger
)
{
Info
.
Println
(
"append reply RPC"
)
//rpc call to the caller
client
,
err
:=
rpc
.
Dial
(
"tcp"
,
hostname
+
":"
+
strconv
.
Itoa
(
logPort
))
if
err
!=
nil
{
Info
.
Fatal
(
"Dialing:"
,
err
)
}
reply
:=
new
(
Reply
)
args
:=
temp
Info
.
Println
(
"[F]: Calling AppendReply RPC"
,
logPort
)
appendReplyCall
:=
client
.
Go
(
"RaftRPCService.AppendReplyRPC"
,
args
,
reply
,
nil
)
//let go allocate done channel
appendReplyCall
=
<-
appendReplyCall
.
Done
Info
.
Println
(
"Reply"
,
appendReplyCall
,
reply
.
X
)
}
func
doVoteRequestRPC
(
hostname
string
,
logPort
int
,
temp
*
VoteRequest
,
rft
*
Raft
)
{
func
doVoteRequestRPC
(
hostname
string
,
logPort
int
,
temp
*
VoteRequest
,
rft
*
Raft
)
{
rft
.
Info
.
Println
(
"[C]:Vote request RPC"
)
rft
.
Info
.
Println
(
"[C]:Vote request RPC"
)
//rpc call to the caller
//rpc call to the caller
client
,
err
:=
rpc
.
Dial
(
"tcp"
,
hostname
+
":"
+
strconv
.
Itoa
(
logPort
))
client
,
err
:=
rpc
.
Dial
(
"tcp"
,
hostname
+
":"
+
strconv
.
Itoa
(
logPort
))
defer
client
.
Close
()
if
err
!=
nil
{
if
err
!=
nil
{
rft
.
Info
.
Fatal
(
"Dialing:"
,
err
)
rft
.
Info
.
Fatal
(
"Dialing:"
,
err
)
}
}
...
@@ -455,6 +441,7 @@ func doVoteRequestRPC(hostname string, logPort int, temp *VoteRequest, rft *Raft
...
@@ -455,6 +441,7 @@ func doVoteRequestRPC(hostname string, logPort int, temp *VoteRequest, rft *Raft
//make append entries rpc call to followers
//make append entries rpc call to followers
func
doAppendRPCCall
(
hostname
string
,
logPort
int
,
temp
*
AppendRPC
,
rft
*
Raft
)
{
func
doAppendRPCCall
(
hostname
string
,
logPort
int
,
temp
*
AppendRPC
,
rft
*
Raft
)
{
client
,
err
:=
rpc
.
Dial
(
"tcp"
,
hostname
+
":"
+
strconv
.
Itoa
(
logPort
))
client
,
err
:=
rpc
.
Dial
(
"tcp"
,
hostname
+
":"
+
strconv
.
Itoa
(
logPort
))
defer
client
.
Close
()
if
err
!=
nil
{
if
err
!=
nil
{
rft
.
Info
.
Fatal
(
"[L]: Dialing:"
,
err
)
rft
.
Info
.
Fatal
(
"[L]: Dialing:"
,
err
)
}
}
...
...
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