Skip to content
Snippets Groups Projects
Commit 9411e51b authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #1067 Generating peer document should not make Duniter crash, ever

parent ef5b332f
No related branches found
No related tags found
No related merge requests found
import {ConfDTO} from "../lib/dto/ConfDTO"; import {ConfDTO} from "../lib/dto/ConfDTO"
import {FileDAL} from "../lib/dal/fileDAL"; import {FileDAL} from "../lib/dal/fileDAL"
import {DBPeer} from "../lib/dal/sqliteDAL/PeerDAL"; import {DBPeer} from "../lib/dal/sqliteDAL/PeerDAL"
import {DBBlock} from "../lib/db/DBBlock"; import {DBBlock} from "../lib/db/DBBlock"
import {Multicaster} from "../lib/streams/multicaster"; import {Multicaster} from "../lib/streams/multicaster"
import {PeerDTO} from "../lib/dto/PeerDTO"; import {PeerDTO} from "../lib/dto/PeerDTO"
import {verify} from "../lib/common-libs/crypto/keyring"; import {verify} from "../lib/common-libs/crypto/keyring"
import {dos2unix} from "../lib/common-libs/dos2unix"; import {dos2unix} from "../lib/common-libs/dos2unix"
import {rawer} from "../lib/common-libs/index"; import {rawer} from "../lib/common-libs/index"
import {Server} from "../../server"; import {Server} from "../../server"
import {GlobalFifoPromise} from "./GlobalFifoPromise"; import {GlobalFifoPromise} from "./GlobalFifoPromise"
const util = require('util'); const util = require('util');
const _ = require('underscore'); const _ = require('underscore');
...@@ -249,8 +249,12 @@ export class PeeringService { ...@@ -249,8 +249,12 @@ export class PeeringService {
p2.pubkey = this.selfPubkey; p2.pubkey = this.selfPubkey;
// Remember this is now local peer value // Remember this is now local peer value
this.peerInstance = p2; this.peerInstance = p2;
try {
// Submit & share with the network // Submit & share with the network
await this.server.writePeer(p2) await this.server.writePeer(p2)
} catch (e) {
logger.error(e)
}
const selfPeer = await this.dal.getPeer(this.selfPubkey); const selfPeer = await this.dal.getPeer(this.selfPubkey);
// Set peer's statut to UP // Set peer's statut to UP
await this.peer(selfPeer); await this.peer(selfPeer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment