mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-25 07:02:25 +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
|
||||
|
||||
this.getPeerInfo = (callback) => {
|
||||
if (conn.getPeerInfo) {
|
||||
if (conn && conn.getPeerInfo) {
|
||||
return conn.getPeerInfo(callback)
|
||||
}
|
||||
|
||||
@ -29,20 +29,21 @@ function Connection (conn) {
|
||||
}
|
||||
|
||||
this.setPeerInfo = (_peerInfo) => {
|
||||
if (conn.setPeerInfo) {
|
||||
if (conn && conn.setPeerInfo) {
|
||||
return conn.setPeerInfo(_peerInfo)
|
||||
}
|
||||
peerInfo = _peerInfo
|
||||
}
|
||||
|
||||
this.getObservedAddrs = (callback) => {
|
||||
if (conn.getObservedAddrs) {
|
||||
if (conn && conn.getObservedAddrs) {
|
||||
return conn.getObservedAddrs(callback)
|
||||
}
|
||||
callback(null, [])
|
||||
}
|
||||
|
||||
this.setInnerConn = (conn) => {
|
||||
this.setInnerConn = (_conn) => {
|
||||
conn = _conn
|
||||
this.setReadable(conn)
|
||||
this.setWritable(conn)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user