Commit 6b03ce0114b8fe5962fd9fc588cf8e0969892366
handle close message from dpid
cel committed on 7/15/2017, 8:44:24 PMParent: 3d01a4bfcb6943007e1b408c20192fce1f2addd7
Files changed
dat.dpi | changed |
dat.dpi | |||
---|---|---|---|
@@ -391,11 +391,22 @@ | |||
391 | 391 … | if (this.url.startsWith('dpi:/dat/')) return this.serveInternal() | |
392 | 392 … | this.serveError('Not found') | |
393 | 393 … | } | |
394 | 394 … | ||
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 … | + | ||
395 | 405 … | DpiReq.prototype.commands = [ | |
396 | 406 … | [/^<cmd='auth' msg='([^']*)' '>/, DpiReq_onAuth], | |
397 | - [/^<cmd='open_url' url='(.*?)' '>/, DpiReq_onOpenUrl] | ||
407 … | + [/^<cmd='open_url' url='(.*?)' '>/, DpiReq_onOpenUrl], | ||
408 … | + [/^<cmd='DpiBye' '>/, DpiReq_onBye], | ||
398 | 409 … | ] | |
399 | 410 … | ||
400 | 411 … | net.createServer({allowHalfOpen: true}, function (c) { | |
401 | 412 … | new DpiReq(c) |
Built with git-ssb-web