PM CTorrent Manager

  This program is a graphical interface to the "Enhanced CTorrent" BitTorrent
  client for OS/2.

  At present, it functions as a (somewhat incomplete) CTCS server and console.
| It can also open torrent files and launch new CTorrent sessions.

  NOTE: This program is still highly experimental.  While it appears to work
        relatively well in my own testing, I cannot vouch for its overall
        reliability at this stage of development.  In particular, I have some
        concerns about its scalability, as it has not been extensively tested 
        with very large numbers of torrents (10 or more).

        In short, this is not production-quality software.  Use it at your own 
        risk.

| PM CTorrent Manager requires a 32-bit TCP/IP stack (MPTS 5.2 or higher).  It
| also requires the VX-REXX 2.1D runtime library (VROBJ.DLL).


How to Use

| You need an OS/2 port of Enhanced CTorrent.  ACT.EXE (available at
| <http://www.os2site.com/sw/internet/peer_peer/index.html>) is recommended.
| You can also use CTORRENT9.EXE, or (in theory) any other port of Enhanced
| CTorrent.
|
| Starting with v0.10, you can now open torrent files and start CTorrent
| from within PMCTM.  At the moment, this requires that you have ACT.EXE
| somewhere in your PATH.  The torrent file management works like this:
|   - When a torrent is started, it is copied to the 'running' directory.
|   - When a torrent finishes downloading, it is marked as complete.  The next
|     time the torrent is started, the torrent file will be moved to the 
|     'seeding' directory.  Torrents in the 'seeding' directory are started
|     without a hash check at startup, to reduce CPU load.
|   - Any torrent files which are located in either the 'running' or 'seeding' 
|     directories but are not actually running at the moment will be displayed 
|     in the GUI with a grey icon, indicating 'stopped' status.
|   - You can remove a 'stopped' torrent via the menu.  This removes the torrent
|     file from the 'running' or 'seeding' directory and moves it to the 
|     'removed' directory.  The 'removed' directory acts as kind of a trash can 
|     for torrent files.  You should manually delete the files from this 
|     directory once you are certain you no longer want them.
|
| The 'running', 'seeding', and 'removed' torrents directories are configurable
| from within the PMCTM GUI.  They MUST be located on volumes which support
| extended attributes (and, preferably, long filenames).
|
| You can also manage torrents which were started with CTorrent manually (i.e.
| outside PMCTM), if you specified -S (CTCS server) option using the local 
| server address with port 2780; for example:
    act.exe -S localhost:2780 somefile.torrent
  If you have other computers on the network, you can run CTorrent there as
  well; simply replace "localhost" in the above example with the IP address
  of the system running PM CTorrent Manager.

  You can start PM CTorrent Manager (PMCTM.EXE) at any time, before or after
  starting your CTorrent session(s).  You can also close and restart it without
  affecting CTorrent.

  The advantage of using PM CTorrent Manager is that you can view, monitor,
  or terminate any or all of your CTorrent downloads from a single window.
  This also lets you run CTorrent detached if you want to, thus not cluttering
  up your desktop and/or window list.  And, of course, you can monitor
  CTorrent downloads on other computers on your network.

| Starting PMCTM.EXE with the '/d' parameter will cause debug output to be
| shown.


Bugs

| PM CTorrent Manager is an extremely complex program, and there will inevitably
| be bugs, possibly including program crashes.  
|
| Known problems:
|
|  - If you restart PMCTM after stopping a torrent, but before the actual
|    corresponding CTorrent process has terminated, and then attempt to resume
|    the stopped torrent, it may show up twice in the GUI.  (I MAY have fixed
|    this bug, but I'm not quite certain yet.)
|
|  - If you reboot the computer, or stop the CTorrent processes while PMCTM is
|    not running, then PMCTM will lose track of the correct state of the
|    corresponding torrents.  PMCTM will be unable to use these torrents again
|    until either:
|      . CTorrent is started manually on these torrents (and only stopped again
|        while PMCTM is running).
|      . The PMCTM.Running EA on the torrent file in the 'running' directory is
|        changed to 0 (e.g. by using REXX or an EA editor).
|      . The torrent is restarted by opening the original torrent file (not the
|        one in the 'running' directory).
|    For this reason, it is strongly recommended that you always allow PMCTM to
|    stop running torrents when closing the program.
|
|  - If CTorrent automatically stops the torrent because it has reached its
|    target seeding time and/or ratio, the torrent may stop showing up in PMCTM.
|    Again, this is due to the PMCTM.Running EA not being cleared.  You can
|    resume seeding via one of the same methods described just above, or remove
|    the torrent manually by deleting it from the 'seeding' or 'running' 
|    directory (whichever it is located in).
|
| As you can guess, the logic I use for identifying running torrents is somewhat
| flawed, and needs to be reworked a bit.  


Changes

| 0.10 (2009-01-30)
|  - Added support for opening torrent files.  Implemented extensive logic for
|    managing torrents started in this way.
|  - Stopped torrents are now shown as well as active ones.
|  - Added directories configuration dialog.
|  - Changed behaviour of the 'confirm on exit' option.  Now it offers you 
|    the choice: stop torrents and exit, don't stop torrents and exit, or
|    cancel (don't exit).
|  - The UI refresh timer is deactivated if there are no active torrents.

  0.08 (2009-09-22)
   - Fixed problem with no splitbar when PMCTM.INI does not exist.
   - Fixed incorrect size display introduced by sorting feature.
   - Fixed various other problems with sorting.

  0.07 (2009-09-02)
   - Added configurable preferences (sort order and shutdown behaviour).
   - Window size/position are now remembered between sessions.

  0.06 (2009-07-12)
   - Redesigned SockRecv() logic to be more robust; also reduces CPU usage.
   - Interim UL/DL rate refresh updates were broken; fixed.
   - Improved detail/peer update logic in details window.
   - Fixed bug where record text would briefly disappear during initial checking
     phase.
   - Dead-torrent timeout increased to 90 seconds.

  0.05 (2009-07-08)
   - Listen thread is now closed with a Halt message instead of on a check in
     the main loop.  This means the program should close much more quickly.
   - Some more tweaks to try and track down CPU load issue (listen thread is
     no longer non-blocking; client threads have added a select timeout).
   - Fixed possible crash when opening details window caused by race condition.
   - Program now handles loss of contact with client (e.g. due to network outage
     or power-down).  Torrents which have stopped sending information to PMCTM
     (for at least 60 seconds) are indicated with a red icon.

  0.04 (2009-06-21)
   - Redesigned refresh logic in the torrent overview container.
   - Increased sleep time in client thread loop (attempt to reduce CPU load).
   - Implemented "Peers" page on the torrent details dialog.
   - Added splitbar to overview container.
   - Various status icon improvements.

  0.03 (2009-06-14)
   - Implemented "Files" page on the torrent details dialog.
   - Added "Size" field to the torrent overview container.
   - Improved efficiency of UL/DL rate updates.
   - Implemented torrent popup menu in the overview container.
   - Some minor code cleanup.

  0.02 (2009-05-26)
   - Fixed 100% CPU on network threads.
   - Detail window now closes gracefully when client connection is lost.
   - Improved data refresh logic for container controls.
   - Fixed minor parsing bug in parameters container Status page.
   - Fixed erroneous display of "Seed time" field when not seeding.
   - Added leading 0s for minutes/seconds in elapsed time displays.
   - Minor cosmetic tweaks.

  0.01 (2009-05-25)
   - First public release.


License

  Copyright (C) 2009 Alex Taylor.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are
  met:

  1. Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

  3. The name of the author may not be used to endorse or promote products
     derived from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.


--
Alex Taylor - http://users.socis.ca/~ataylo00/
