assign conn to the object level scope

This commit is contained in:
David Dias 2016-06-27 10:06:09 +01:00
parent a8178c3c77
commit 5c1d18924d

View File

@ -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)
}