Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
132d6fae
Commit
132d6fae
authored
May 22, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: Only use reset on streams
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
8b7bf266
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
21 deletions
+5
-21
core/commands/p2p.go
core/commands/p2p.go
+1
-1
p2p/stream.go
p2p/stream.go
+4
-20
No files found.
core/commands/p2p.go
View file @
132d6fae
...
...
@@ -386,7 +386,7 @@ var p2pStreamCloseCmd = &cmds.Command{
if
!
closeAll
&&
handlerID
!=
stream
.
Id
{
continue
}
stream
.
Clo
se
()
stream
.
Re
se
t
()
if
!
closeAll
{
break
}
...
...
p2p/stream.go
View file @
132d6fae
...
...
@@ -27,14 +27,6 @@ type Stream struct {
Registry
*
StreamRegistry
}
// Close closes stream endpoints and deregisters it
func
(
s
*
Stream
)
Close
()
error
{
s
.
Local
.
Close
()
s
.
Remote
.
Close
()
s
.
Registry
.
Deregister
(
s
.
Id
)
return
nil
}
// Reset closes stream endpoints and deregisters it
func
(
s
*
Stream
)
Reset
()
error
{
s
.
Local
.
Close
()
...
...
@@ -45,21 +37,13 @@ func (s *Stream) Reset() error {
func
(
s
*
Stream
)
startStreaming
()
{
go
func
()
{
_
,
err
:=
io
.
Copy
(
s
.
Local
,
s
.
Remote
)
if
err
!=
nil
{
s
.
Reset
()
}
else
{
s
.
Close
()
}
io
.
Copy
(
s
.
Local
,
s
.
Remote
)
s
.
Reset
()
}()
go
func
()
{
_
,
err
:=
io
.
Copy
(
s
.
Remote
,
s
.
Local
)
if
err
!=
nil
{
s
.
Reset
()
}
else
{
s
.
Close
()
}
io
.
Copy
(
s
.
Remote
,
s
.
Local
)
s
.
Reset
()
}()
}
...
...
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