jackpal / Taipei-Torrent

A(nother) Bittorrent client written in the go programming language
BSD 3-Clause "New" or "Revised" License
845 stars 123 forks source link

Quick fix: Close filestore and filesystem when shutting down. #87

Closed Zilog8 closed 9 years ago

Zilog8 commented 9 years ago

So, apparently fileStore.Close(), despite existing previously, was never actually called. In previous versions this had no ill effect, but now it means that the cache isn't being cleared.

This commit adds a call for fileStore.Close() to TorrentSession.Shutdown(). Thus it gets called if: a) The torrent is done seeding b) User input Ctrl-C

Also, investigating this bug led me to notice that the SFTP connection wasn't being closed gracefully, so I've added io.Closer to the FileSystem interface and added a call for it to fileStore.Close().