git ssb

0+

cel / dillo-dat



Commit 6b03ce0114b8fe5962fd9fc588cf8e0969892366

handle close message from dpid

cel committed on 7/15/2017, 8:44:24 PM
Parent: 3d01a4bfcb6943007e1b408c20192fce1f2addd7

Files changed

dat.dpichanged
dat.dpiView
@@ -391,11 +391,22 @@
391391 if (this.url.startsWith('dpi:/dat/')) return this.serveInternal()
392392 this.serveError('Not found')
393393 }
394394
395 +function DpiReq_onBye(m) {
396 + if (!this.authed) {
397 + var addr = this.socket.remoteAddress + ':' + this.socket.remotePort
398 + console.error('[dat dpi] un-authed bye from', this.getAddress())
399 + return this.socket.end()
400 + }
401 + console.log('[dat dpi] stopping')
402 + process.exit(0)
403 +}
404 +
395405 DpiReq.prototype.commands = [
396406 [/^<cmd='auth' msg='([^']*)' '>/, DpiReq_onAuth],
397- [/^<cmd='open_url' url='(.*?)' '>/, DpiReq_onOpenUrl]
407 + [/^<cmd='open_url' url='(.*?)' '>/, DpiReq_onOpenUrl],
408 + [/^<cmd='DpiBye' '>/, DpiReq_onBye],
398409 ]
399410
400411 net.createServer({allowHalfOpen: true}, function (c) {
401412 new DpiReq(c)

Built with git-ssb-web