Skip to content

Commit 5846e27

Browse files
committed
report addresses and i2p errors
1 parent a8719f4 commit 5846e27

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/service/service-host.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,25 @@ class ServiceHost {
134134
this.apiServer.on('error', this.handleServerError.bind(this))
135135

136136
debug('server listening')
137-
debug('address', this.apiServer.address())
137+
debug('\t', 'address', this.apiServer.address())
138138

139139
if(this.wsServer && this.apiServer){
140140
debug('starting websocket')
141141
this.wsServer.start(this.apiServer)
142142
}
143143

144-
if(this.i2pEnabled){
144+
if(this.i2pEnabled && this.i2p == null){
145145
debug('starting i2p forward')
146146
const SAM = require('@diva.exchange/i2p-sam')
147147

148-
this.i2p = await i2p.createForward(this.i2pSettings)
148+
this.i2p = await SAM.createForward(this.i2pSettings)
149149
this.i2pUri = this.i2p.getPublicKeys()
150150
this.i2pSettings.privateKey = null // clear no longer needed
151151

152+
this.i2p.on('error', this.reportI2pError.bind(this))
152153

153-
debug('i2p address - ', this.i2pUri)
154+
debug('i2p started')
155+
debug('\t','address', this.i2pUri)
154156
}
155157
}
156158

@@ -169,6 +171,10 @@ class ServiceHost {
169171
debug('stopped server')
170172
}
171173

174+
reportI2pError(error){
175+
debug('WARN - I2P ERROR -', JSON.stringify(error), error.toString())
176+
}
177+
172178
handleServerError(error){
173179
debug('CRITICAL ERROR - ', JSON.stringify(error))
174180
this.errorHandlerTimer = setTimeout( ()=>{

0 commit comments

Comments
 (0)