Skip to content
This repository has been archived by the owner on Jul 29, 2023. It is now read-only.

BufferedStream not closed when a client disconnects #3

Open
lkollar opened this issue Dec 24, 2015 · 1 comment
Open

BufferedStream not closed when a client disconnects #3

lkollar opened this issue Dec 24, 2015 · 1 comment
Assignees
Labels

Comments

@lkollar
Copy link
Owner

lkollar commented Dec 24, 2015

This causes a crash when the next clients start playback:

/home/lkollar/aircast/node_modules/bufferedstream/index.js:27
      throw new Error('BufferedStream is already piped');
      ^

Error: BufferedStream is already piped
    at BufferedStream.<anonymous> (/home/lkollar/aircast/node_modules/bufferedstream/index.js:27:13)
    at emitOne (events.js:77:13)
    at BufferedStream.emit (events.js:169:7)
    at OutputStream.Readable.pipe (/home/lkollar/aircast/node_modules/readable-stream/lib/_stream_readable.js:635:8)
    at null.<anonymous> (/home/lkollar/aircast/index.js:159:16)
    at emitOne (events.js:77:13)
    at NodeTunes.emit (events.js:169:7)
    at announceParse (/home/lkollar/aircast/node_modules/nodetunes/lib/rtspmethods.js:141:25)
    at announce (/home/lkollar/aircast/node_modules/nodetunes/lib/rtspmethods.js:81:7)
    at RtspServer.<anonymous> (/home/lkollar/aircast/node_modules/nodetunes/lib/rtsp.js:60:7)
    at emitTwo (events.js:87:13)
    at ServerParser.emit (events.js:172:7)
    at ServerParser._emitMessage (/home/lkollar/aircast/node_modules/httplike/lib/server-parser.js:28:8)
    at ServerParser.Parser._write (/home/lkollar/aircast/node_modules/httplike/lib/parser.js:103:12)
    at doWrite (_stream_writable.js:292:12)
@lkollar lkollar added the bug label Dec 24, 2015
@lkollar lkollar self-assigned this Dec 24, 2015
@lkollar
Copy link
Owner Author

lkollar commented Jan 2, 2016

I haven't looked into this in detail but I think what's happening is that when a new client connects (or the same client reconnects) the buffer cannot be reused. One simple solution is to create the buffer on a new connection only and close it on disconnect. I'm not sure we can get a disconnect event from airtunes, have to look into that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant