mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-25 12:52:35 +00:00
assign conn to the object level scope
This commit is contained in:
parent
a8178c3c77
commit
5c1d18924d
@ -17,7 +17,7 @@ function Connection (conn) {
|
|||||||
let peerInfo
|
let peerInfo
|
||||||
|
|
||||||
this.getPeerInfo = (callback) => {
|
this.getPeerInfo = (callback) => {
|
||||||
if (conn.getPeerInfo) {
|
if (conn && conn.getPeerInfo) {
|
||||||
return conn.getPeerInfo(callback)
|
return conn.getPeerInfo(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,20 +29,21 @@ function Connection (conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setPeerInfo = (_peerInfo) => {
|
this.setPeerInfo = (_peerInfo) => {
|
||||||
if (conn.setPeerInfo) {
|
if (conn && conn.setPeerInfo) {
|
||||||
return conn.setPeerInfo(_peerInfo)
|
return conn.setPeerInfo(_peerInfo)
|
||||||
}
|
}
|
||||||
peerInfo = _peerInfo
|
peerInfo = _peerInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getObservedAddrs = (callback) => {
|
this.getObservedAddrs = (callback) => {
|
||||||
if (conn.getObservedAddrs) {
|
if (conn && conn.getObservedAddrs) {
|
||||||
return conn.getObservedAddrs(callback)
|
return conn.getObservedAddrs(callback)
|
||||||
}
|
}
|
||||||
callback(null, [])
|
callback(null, [])
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setInnerConn = (conn) => {
|
this.setInnerConn = (_conn) => {
|
||||||
|
conn = _conn
|
||||||
this.setReadable(conn)
|
this.setReadable(conn)
|
||||||
this.setWritable(conn)
|
this.setWritable(conn)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user