Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
a6299fc4
Commit
a6299fc4
authored
Dec 11, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer/rpc: log when client closes mux
parent
fed689bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
packer/rpc/client.go
packer/rpc/client.go
+19
-5
No files found.
packer/rpc/client.go
View file @
a6299fc4
...
...
@@ -3,6 +3,7 @@ package rpc
import
(
"github.com/mitchellh/packer/packer"
"io"
"log"
"net/rpc"
)
...
...
@@ -10,12 +11,19 @@ import (
// Establishing a connection is up to the user, the Client can just
// communicate over any ReadWriteCloser.
type
Client
struct
{
mux
*
MuxConn
client
*
rpc
.
Client
mux
*
MuxConn
client
*
rpc
.
Client
closeMux
bool
}
func
NewClient
(
rwc
io
.
ReadWriteCloser
)
(
*
Client
,
error
)
{
return
NewClientWithMux
(
NewMuxConn
(
rwc
),
0
)
result
,
err
:=
NewClientWithMux
(
NewMuxConn
(
rwc
),
0
)
if
err
!=
nil
{
return
nil
,
err
}
result
.
closeMux
=
true
return
result
,
err
}
func
NewClientWithMux
(
mux
*
MuxConn
,
streamId
uint32
)
(
*
Client
,
error
)
{
...
...
@@ -25,8 +33,9 @@ func NewClientWithMux(mux *MuxConn, streamId uint32) (*Client, error) {
}
return
&
Client
{
mux
:
mux
,
client
:
rpc
.
NewClient
(
clientConn
),
mux
:
mux
,
client
:
rpc
.
NewClient
(
clientConn
),
closeMux
:
false
,
},
nil
}
...
...
@@ -35,6 +44,11 @@ func (c *Client) Close() error {
return
err
}
if
c
.
closeMux
{
log
.
Printf
(
"[WARN] Client is closing mux"
)
return
c
.
mux
.
Close
()
}
return
nil
}
...
...
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