Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
edc7b0f6
提交
edc7b0f6
authored
12月 07, 2015
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update go-peerstream dep
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
上级
d58053b2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
25 行增加
和
4 行删除
+25
-4
Godeps.json
Godeps/Godeps.json
+1
-1
conn.go
...ps/_workspace/src/github.com/jbenet/go-peerstream/conn.go
+22
-2
muxt.go
...space/src/github.com/jbenet/go-peerstream/muxtest/muxt.go
+1
-0
swarm.go
...s/_workspace/src/github.com/jbenet/go-peerstream/swarm.go
+1
-1
没有找到文件。
Godeps/Godeps.json
浏览文件 @
edc7b0f6
...
...
@@ -200,7 +200,7 @@
},
{
"ImportPath"
:
"github.com/jbenet/go-peerstream"
,
"Rev"
:
"f
90119e97e8be7b2bdd5e598067b0dc44df63381
"
"Rev"
:
"f
3ab20739a88aa79306dc039c1b5a39e7afa45d6
"
},
{
"ImportPath"
:
"github.com/jbenet/go-random"
,
...
...
Godeps/_workspace/src/github.com/jbenet/go-peerstream/conn.go
浏览文件 @
edc7b0f6
...
...
@@ -47,6 +47,9 @@ type Conn struct {
closed
bool
closeLock
sync
.
Mutex
closing
bool
closingLock
sync
.
Mutex
}
func
newConn
(
nconn
net
.
Conn
,
tconn
smux
.
Conn
,
s
*
Swarm
)
*
Conn
{
...
...
@@ -115,14 +118,31 @@ func (c *Conn) Streams() []*Stream {
return
streams
}
// GoClose spawns off a goroutine to close the connection iff the connection is
// not already being closed and returns immediately
func
(
c
*
Conn
)
GoClose
()
{
c
.
closingLock
.
Lock
()
defer
c
.
closingLock
.
Unlock
()
if
c
.
closing
{
return
}
c
.
closing
=
true
go
c
.
Close
()
}
// Close closes this connection
func
(
c
*
Conn
)
Close
()
error
{
c
.
closeLock
.
Lock
()
defer
c
.
closeLock
.
Unlock
()
if
c
.
closed
{
if
c
.
closed
==
true
{
return
nil
}
c
.
closingLock
.
Lock
()
c
.
closing
=
true
c
.
closingLock
.
Unlock
()
c
.
closed
=
true
// close streams
...
...
Godeps/_workspace/src/github.com/jbenet/go-peerstream/muxtest/muxt.go
浏览文件 @
edc7b0f6
...
...
@@ -14,6 +14,7 @@ import (
"testing"
ps
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
smux
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-stream-muxer"
)
...
...
Godeps/_workspace/src/github.com/jbenet/go-peerstream/swarm.go
浏览文件 @
edc7b0f6
...
...
@@ -184,7 +184,7 @@ func (s *Swarm) Conns() []*Conn {
open
:=
make
([]
*
Conn
,
0
,
len
(
conns
))
for
_
,
c
:=
range
conns
{
if
c
.
smuxConn
.
IsClosed
()
{
c
.
Close
()
c
.
Go
Close
()
}
else
{
open
=
append
(
open
,
c
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论