Compare commits

...

1728 Commits

Author SHA1 Message Date
bc9172be83 fix date in changelog 2007-12-01 18:31:05 +00:00
5ebeb3ef4f tweak full hd warning - disable it in libtorrent 2007-12-01 06:45:43 +00:00
ab420e4fed update changelogs and up trunk version 2007-12-01 04:20:47 +00:00
14eaf79371 tag fix release 2007-12-01 04:12:54 +00:00
f757efde4d sync lt to rc_0_13 branch 2007-12-01 04:07:11 +00:00
cfe1bd241d fix duplicant_torrent and libtorrent bugfixes 2007-12-01 03:54:42 +00:00
2eb3868115 increase tracker timeout 2007-12-01 03:24:36 +00:00
5b71f1f6d9 up trunk version number post release 2007-11-27 23:16:11 +00:00
7d5e079336 remove webui example template 2007-11-27 21:35:16 +00:00
039c5591ed sync languages for release 2007-11-27 19:18:55 +00:00
e00fece477 fix portuguese encryption translation 2007-11-27 18:56:31 +00:00
fb5d4c8e55 gtk stock non translatable again 2007-11-27 18:10:36 +00:00
36a5440858 webui button fix from vonck 2007-11-26 23:21:34 +00:00
b3ab64182e webui rev161 2007-11-26 19:43:51 +00:00
47acfd93ea try to catch invalid_handle in add_torrent 2007-11-26 18:56:17 +00:00
9ec83822a0 tweak replace_tracker in core.py 2007-11-26 17:31:22 +00:00
d288e39a54 tweak try/catch again 2007-11-26 17:03:04 +00:00
8c5355498c tweak boost library variables 2007-11-26 16:42:07 +00:00
4dad638a41 webui tweaks rev 160 2007-11-26 16:06:55 +00:00
1698c57f58 tweak get_index_from_unique_id 2007-11-26 06:07:47 +00:00
f96cc8e56a fix typo 2007-11-26 05:57:31 +00:00
675a286f8a make sure simplerss does not load 2007-11-26 05:40:24 +00:00
0d51bb250e fix indent 2007-11-26 04:57:28 +00:00
8f6bb96df0 add catch to get_index_from_unique_id 2007-11-26 04:48:11 +00:00
32fc9bbf07 tweak last 2007-11-26 02:20:40 +00:00
b7983a5ab4 catch invalid_handle on add_torrent 2007-11-26 02:04:55 +00:00
776ed5a9d8 another attempt for invalid handle 2007-11-26 00:59:28 +00:00
6595fe0621 fix webseed 2007-11-26 00:17:48 +00:00
fd7d1ce675 try to catch invalid handle in deluge_core 2007-11-25 23:59:19 +00:00
e0367895b7 torrent info labels selectable 2007-11-25 22:02:44 +00:00
1e65e4e396 Apply logfile patch for Windows build from Slurdge. 2007-11-25 12:16:29 +00:00
51bc2329c2 use system setting for toolbar text/icon style 2007-11-25 01:51:00 +00:00
5c7031ab80 cleanup trackers replace 2007-11-25 01:11:19 +00:00
9c3929f15e dont die if plugin in prefs.state is not found on the filesystem 2007-11-24 22:46:43 +00:00
ee409d71c5 fix add torrent in webui 2007-11-24 20:39:55 +00:00
9777d4e00c skip taskbar fix for win 2007-11-24 19:54:00 +00:00
7e9576a947 language files sync 2007-11-24 19:30:42 +00:00
1b0f7e89c1 asio fix for win32 2007-11-24 18:39:00 +00:00
fbf7564d42 up version number for rc release 2007-11-24 16:55:33 +00:00
0b2faf6ee1 add python-pyopenssl to README depend list 2007-11-24 16:31:02 +00:00
cda1b3aa98 update webui, show error on permission failure, differentiate queued vs paused 2007-11-24 16:22:49 +00:00
ced47db339 tweak full hd dialog when adding a new torrent 2007-11-24 05:00:08 +00:00
b221e7ac82 tweak full hd dialog 2007-11-24 04:58:57 +00:00
19f38da504 tweak tooltip 2007-11-24 03:56:11 +00:00
54aca23618 update changelog 2007-11-24 03:52:59 +00:00
dde291d6dd add connection_speed setting 2007-11-24 03:51:11 +00:00
adb7bcdf38 set max_half_open default to 20 if not on a windows system 2007-11-24 03:12:18 +00:00
ceaec1897d update changelog 2007-11-24 03:02:07 +00:00
e701fa28ba fix merge trackers 2007-11-24 02:58:23 +00:00
5701324e00 dont pause prior to move_storage 2007-11-24 01:58:54 +00:00
71bee41ff0 ipv6 listen fix 2007-11-23 23:23:41 +00:00
54bba4d74c fix for when lsd/natpmp/upnp are started twice 2007-11-23 21:18:26 +00:00
063fe8fe2d default not to use upnp 2007-11-22 23:19:14 +00:00
2cb306ca86 new languages - bs, nds and hi 2007-11-22 23:18:14 +00:00
e617c1d3b7 remove dumb tb_middle and tb_right 2007-11-22 23:17:45 +00:00
bb03e2ff6a deal with stupid gutsy sometimes not being able to connect to dbus 2007-11-22 22:26:06 +00:00
4b7d40ed49 lang sync 2007-11-22 17:29:21 +00:00
cc0d1502cc revert webui 2007-11-22 04:20:42 +00:00
74f739a693 identify miro client 2007-11-22 02:42:07 +00:00
22317356c5 plugin name translations 2007-11-22 00:02:06 +00:00
037be4d170 tweak local setting 2007-11-21 23:42:35 +00:00
d918302e3e sync webui rev 143 2007-11-21 22:32:18 +00:00
fde0c836aa re-add features that our isp lost in the backup 2007-11-21 22:18:11 +00:00
d9a783118a fast resume fix 2007-11-20 03:37:15 +00:00
3e6b577b1b fix blocklist load on start 2007-11-20 01:59:51 +00:00
19ee80cfab pause torrent before fastresume save if in compact mode 2007-11-20 01:21:22 +00:00
7b6ece4a2c lt update 2007-11-19 18:21:36 +00:00
a0b2638ffb fix category 2007-11-19 16:24:42 +00:00
8b4053dd2e fix wizard apply_prefs mess 2007-11-19 15:17:24 +00:00
9afc4ce936 lt sync 1746 2007-11-19 14:14:22 +00:00
1ae6dbf871 allow creation of torrents without trackers 2007-11-19 12:51:46 +00:00
3d1cd9bf00 update lang template 2007-11-19 02:29:22 +00:00
15983c8901 fix typo 2007-11-19 02:10:57 +00:00
7bdf7e9d1e fix eta 2007-11-19 00:43:33 +00:00
34e0a0e839 tweak pause/resume all 2007-11-19 00:27:56 +00:00
1c369bce31 same 2007-11-18 23:46:33 +00:00
9b88b8d61f tweak set_user_pause 2007-11-18 23:45:16 +00:00
423cce7c56 fix oops in last 2007-11-18 23:29:47 +00:00
43ad15b3b2 fix pause all / resume all problems 2007-11-18 23:22:36 +00:00
5a01eec297 add proper preferences for selection popup 2007-11-18 22:57:10 +00:00
06e8a0c6b9 update changelog 2007-11-18 22:27:40 +00:00
b0f991b43c only popup file selection if torrent has more than 1 file 2007-11-18 22:20:22 +00:00
61a4842bed remove remap 2007-11-18 22:09:21 +00:00
06eaabc45f update desktop file 2007-11-18 19:42:46 +00:00
553bdcc3a6 remove lsd...damnit 2007-11-18 09:17:55 +00:00
3eab9473bf lt fix 1737 2007-11-18 09:10:23 +00:00
3a77185e1e reanable lsd with custom fix to lt 2007-11-18 05:18:12 +00:00
63fa4601fb force recheck fix 2007-11-18 04:49:25 +00:00
77f6be5aac disable lsd 2007-11-18 04:30:18 +00:00
f5f7f04e1e fix lsd 2007-11-18 04:13:41 +00:00
8e22078402 fixes for gcc-4.3 2007-11-18 02:16:31 +00:00
d0d2e59192 fix last oops 2007-11-18 00:37:30 +00:00
b793646437 use sysconfig for libdir 2007-11-18 00:35:52 +00:00
51eceeae3a redo -mt detection 2007-11-18 00:09:48 +00:00
dba9a65749 remove separate libtorrent comment 2007-11-17 20:47:46 +00:00
bbbc8024e5 fix for opensuse 10.3 being retarded 2007-11-17 20:13:00 +00:00
989abbc531 multiple torrents update tracker 2007-11-17 19:53:56 +00:00
dc2f24344c asio sync 2007-11-17 12:22:22 +00:00
732c3d8674 lt sync 1732 2007-11-17 11:45:19 +00:00
4ff0a04608 disable lsd for now 2007-11-17 11:39:05 +00:00
1163096a70 remove abort 2007-11-17 11:21:09 +00:00
e47f0a756e remove locations plugin 2007-11-17 10:46:59 +00:00
709b2a04a3 tweaks to shutdown 2007-11-17 10:29:31 +00:00
94a159a66f remove uneffective hide 2007-11-17 09:58:52 +00:00
de8b55c9ed fix plugins on restart 2007-11-17 09:15:08 +00:00
85f9b8bf41 more scheduler fixes/tweaks from ben 2007-11-17 09:12:12 +00:00
0c83ffc391 code cleanup on advanced progress bar and clear adv bar on torrent removal 2007-11-17 09:10:24 +00:00
0c5c099097 save plugin state on plugin enable/disable, instead of on shutdown. remembers active plugins in case of a crash 2007-11-17 08:14:27 +00:00
e4ab021d20 set proper transient for other speed dialog 2007-11-17 07:55:44 +00:00
e21da8636e tweak remap dialog size 2007-11-17 05:57:51 +00:00
f40e5522bd cleanup 2007-11-17 04:12:41 +00:00
7e175dd4c0 remap files update 2007-11-17 03:21:34 +00:00
b764486bff deal with blank trackers in force recheck and between sessions 2007-11-16 20:56:50 +00:00
5a90e14794 edit empty trackers fix 2007-11-16 20:11:58 +00:00
2a8d36029e Fix memory leak. 2007-11-16 08:27:34 +00:00
052894e805 readd advanced progress bar and beginnings of remap_files 2007-11-16 08:08:33 +00:00
0b582261ec lt sync 1727 2007-11-16 00:52:10 +00:00
b95e3c4988 hopefully fix shutdown hang and tweak win compile 2007-11-15 04:38:35 +00:00
abc9534f7f Add --config switch to specify the config directory on startup. Patch
from slurdge.
2007-11-14 23:40:05 +00:00
2b519730bc remove remnant of adv progress bar 2007-11-14 02:07:20 +00:00
edfd988cf9 add torrent in paused state option 2007-11-13 23:15:17 +00:00
f7a1db3be7 remove advanced progress bar 2007-11-13 20:30:55 +00:00
de2f265c2a update todo 2007-11-13 04:33:57 +00:00
97f2f244ae fixes to scheduler from ben 2007-11-13 03:18:44 +00:00
c4c8539401 small ui tweaks 2007-11-12 22:43:45 +00:00
fced9a2c71 dont crash on empty tracker list 2007-11-12 22:39:59 +00:00
ebe0ac39d9 update todo 2007-11-12 22:23:26 +00:00
2e86ebc6ee copy translator credits from launchpad to our about->credits 2007-11-12 21:59:54 +00:00
fd817f5e76 only show queue arrows if there are two or more torrents loaded 2007-11-12 19:59:46 +00:00
70b7c120bc scheduler revamp by ben klein 2007-11-12 08:37:20 +00:00
091b57d65f tweak webseed glade file 2007-11-12 07:36:00 +00:00
31b05cfaa9 tweak last 2007-11-12 06:25:19 +00:00
d7c7222d4f fix wizard not working if firstrun file is already created 2007-11-12 05:49:26 +00:00
efc8179261 cancels more async operations on shutdown 2007-11-11 20:55:48 +00:00
3400c444a8 adding add torrent in pause state to TODO 2007-11-11 03:37:14 +00:00
b6ff01e7c7 update pot file 2007-11-11 01:37:41 +00:00
89533158e6 revert back to delete m_ses and no abort 2007-11-11 00:20:06 +00:00
3eb3ab5b6b dont delete m_ses 2007-11-11 00:04:46 +00:00
812eeb024e revert queue 2007-11-10 19:57:51 +00:00
56e8db547c cleaning up tabs/spaces 2007-11-10 18:56:18 +00:00
6a51a4b9ed tweak last 2007-11-10 08:16:43 +00:00
d3fe619f11 fix queue oops 2007-11-10 08:12:23 +00:00
8886ee9a59 tweak adv progress bar border 2007-11-10 07:50:16 +00:00
5c75c5192f fix oops 2007-11-10 07:29:10 +00:00
e7a789e453 fix ident/tabs 2007-11-10 07:28:36 +00:00
6e58e5113f fix toolbar 2007-11-10 07:13:34 +00:00
2c48226cdc fix oops 2007-11-10 05:11:25 +00:00
d1f2aed58b add advanced progress bar option - modified extensively from patch by arnab 2007-11-10 05:10:28 +00:00
6da46bc546 Add separate preference for max downloading torrents and max seeding torrents 2007-11-10 02:46:27 +00:00
b645417689 tweak save_upmem 2007-11-09 22:32:18 +00:00
da9bf950a7 remember file priorities in force recheck 2007-11-09 21:54:10 +00:00
4e8d9b6e6d tweak shutdown 2007-11-09 21:07:14 +00:00
576b81e910 clean force recheck 2007-11-09 20:36:02 +00:00
24b6def6bd little code cleanup 2007-11-09 01:12:42 +00:00
1f24972c9d use lazy_bitfield 2007-11-08 22:13:47 +00:00
14c34684dc change force recheck to redo 2007-11-08 07:41:11 +00:00
1bc07d2d8e add total seeding torrents to todo 2007-11-08 07:28:29 +00:00
8bf1c1e60a fix recheck oops 2007-11-08 04:22:39 +00:00
8b13d85bdc fix queue 2007-11-08 04:21:34 +00:00
4eb0e558a8 update changelog 2007-11-08 03:18:43 +00:00
2dfb02e062 fix eta from going backwards 2007-11-08 03:17:26 +00:00
92c9d28d0c call it peer exchange, not utorrent peer exchange 2007-11-08 03:07:27 +00:00
554ad73aa1 tweak glade file 2007-11-08 03:05:03 +00:00
d94694fc73 add local discovery of peers 2007-11-08 02:44:22 +00:00
e2e507b94b warning fix 2007-11-07 03:09:42 +00:00
8d6b749a5d add flex to changelog 2007-11-07 02:00:04 +00:00
23c83e6bb1 again 2007-11-07 01:06:36 +00:00
6d70add980 tweak shutdown 2007-11-07 00:24:23 +00:00
6b3065d2cf sync webui 127 2007-11-06 23:34:23 +00:00
047a32ef9f testing some shutdown tweaks 2007-11-06 22:27:07 +00:00
ab9a3f778f cia test 2007-11-06 22:05:34 +00:00
179b5f8c55 add hd warning to changelog 2007-11-06 21:32:15 +00:00
f9e5157d6e ui warning of out of hd space 2007-11-06 21:30:12 +00:00
86732c72d0 get duplicate error again 2007-11-06 21:04:34 +00:00
09798cd394 raise error 2007-11-06 20:46:11 +00:00
0998506f9f make gtk-stock strings not translatable 2007-11-06 20:19:37 +00:00
5f21c9d276 try to solve unicode problem 2007-11-06 19:24:26 +00:00
8050c3f8a6 add torrent notification plugin as default 2007-11-06 08:20:40 +00:00
4b21cc6bf1 add ratio fix to changelog 2007-11-06 04:20:42 +00:00
c244b29a03 tweak changelog 2007-11-06 04:16:37 +00:00
9ac2b85068 fix queue in force recheck 2007-11-06 04:09:40 +00:00
5383d6d197 remove debug print 2007-11-06 03:45:19 +00:00
9b170fe759 remove stupid raise 2007-11-06 03:38:44 +00:00
a624ff5557 tweak uploaded memory in force-recheck 2007-11-06 02:51:23 +00:00
1d36020f9d make force-recheck remember trackers and upload memory 2007-11-06 02:25:21 +00:00
cdb6450d48 remove unneeded code 2007-11-05 23:42:00 +00:00
ca51b3eeff tweak to get uid after force recheck 2007-11-05 23:33:47 +00:00
b48956397f update todo 2007-11-05 23:30:34 +00:00
319bc25cd5 manual force-recheck 2007-11-05 22:34:05 +00:00
e202a79dc3 update lang for last 2007-11-05 17:19:01 +00:00
63ac691e64 remove simplerss and add flexrss 2007-11-05 17:17:30 +00:00
a769af2262 add progress bar to todo 2007-11-05 01:32:49 +00:00
0dcc01c942 implement autoload directory preference 2007-11-05 01:05:34 +00:00
580d2a2e84 add preference for torrent files location 2007-11-04 23:55:37 +00:00
91d8ad33ae add error management to blocklist plugin 2007-11-04 22:33:55 +00:00
67e79250d2 piece picker assert fix 2007-11-04 21:32:07 +00:00
0898680adc lt update 1719 2007-11-02 23:43:09 +00:00
b64bbf1e76 tweak bindings 2007-11-02 22:24:52 +00:00
330b4c2115 no need to save config here since interface does it before passing it over 2007-11-02 21:25:14 +00:00
8adff80407 fix plugin oops 2007-11-02 20:40:26 +00:00
a09c03dafd quicker window shutdown 2007-11-02 20:00:58 +00:00
3610c30a25 minor tweak 2007-11-02 19:53:18 +00:00
9ecb8a388d revert libtorrent updates 2007-11-02 19:08:15 +00:00
3733b91d32 fix ratio and remember trackers 2007-11-02 18:33:37 +00:00
b144525cab lt exception tweaks 1719 2007-11-02 02:29:33 +00:00
2eec0a766d lt sync 1717 2007-11-02 00:49:26 +00:00
b3cdf1371c use full alloc 2007-11-01 22:40:04 +00:00
bd8329e971 only set_icon when not in windows 2007-11-01 22:32:46 +00:00
3c94a2039d fix dos format 2007-11-01 05:49:06 +00:00
c446d60ecd fix minor oops 2007-10-31 11:40:56 +00:00
3ab044409f fixing up libtorrent and tagging 0.5.6.2 2007-10-31 07:49:48 +00:00
5ad442341f use try in case pygame isnt installed 2007-10-31 05:46:49 +00:00
a4373ef156 use try in case pynotify isnt installed 2007-10-31 05:45:07 +00:00
9604c3ff09 update changelog 2007-10-31 04:23:37 +00:00
64aeb867a4 make sound not sensitive on windows 2007-10-31 03:52:55 +00:00
99065bf452 webui sync 117 2007-10-31 03:46:36 +00:00
2a9455e50a lt sync 1710 2007-10-31 02:00:53 +00:00
15d39eeb54 fix total_size 2007-10-29 23:41:44 +00:00
cf2c4a50f4 webui sync 115 2007-10-29 20:01:37 +00:00
054f7e5721 fix max upload for 256k 2007-10-29 05:46:49 +00:00
6520e618c2 forget reloading saved trackers 2007-10-29 03:54:09 +00:00
c059d5162b sync asio 2007-10-29 03:10:12 +00:00
9b59c0507e fix hang on shutdown 2007-10-29 01:01:48 +00:00
4cca79c764 2007-10-29 00:16:42 +00:00
2bac676de7 update todo 2007-10-28 23:20:44 +00:00
f21eb1c3f4 Fix plugin sub-dir code to work in Windows. 2007-10-28 10:34:40 +00:00
925416dded try to fix persistent.state pooping 2007-10-28 02:00:47 +00:00
cd2f45da92 sync webui 112 and translate 2007-10-28 01:35:27 +00:00
019ea1f601 make webui name/description translatable 2007-10-28 00:55:43 +00:00
2949ab545d fix crash on exit 2007-10-27 22:07:57 +00:00
3ed1de43c2 fix bug which made set_max_connections not work 2007-10-27 21:22:54 +00:00
902e8a2526 lt sync 1900 2007-10-26 20:28:03 +00:00
dead0864ad better way to show number of connections 2007-10-26 20:10:29 +00:00
9bd76e077a update changelog 2007-10-26 03:20:43 +00:00
eec0be17f9 add piece size 2048 and make default piece size 256kb 2007-10-26 03:19:30 +00:00
0a0183b0b9 add description to about dialog 2007-10-26 02:56:52 +00:00
d320f2aebe update todo for 0.5.7 2007-10-26 01:48:00 +00:00
38471aa832 upnp/lsd/natpmp fixes 1699 2007-10-26 01:38:04 +00:00
4bb1f06fd3 lt sync 1694 2007-10-25 22:20:56 +00:00
cbeb2c6e6c add new languages 2007-10-25 22:20:38 +00:00
2b12b10f8c update version numbers in trunk 2007-10-25 01:15:46 +00:00
557d90987c dont show 0.0kbps by Arnab 2007-10-25 01:10:20 +00:00
dbbace5f23 piece picker priority fix 2007-10-24 00:30:21 +00:00
a534f23661 update webui version num and add missed file 2007-10-23 22:30:37 +00:00
a28e33b809 sync with webui rev87 2007-10-23 22:16:37 +00:00
ac00fef1d4 only replace tracker if handle is valid 2007-10-23 22:14:22 +00:00
f436cbff64 hopefully fix segfault 2007-10-23 22:02:15 +00:00
74e5e49ee1 try to catch replace trackers error 2007-10-23 20:51:15 +00:00
1bf007907c tweak last attribute except 2007-10-23 07:35:23 +00:00
0bec032638 fix last 2007-10-23 06:49:27 +00:00
d17f6ee274 fix attribute error 2007-10-23 06:45:21 +00:00
571ecbdfac have name column expand 2007-10-23 06:35:46 +00:00
92c4adc4c1 sync language files with launchpad for release 2007-10-23 03:36:01 +00:00
80f941a249 tweak ratio fix 2007-10-23 03:32:58 +00:00
c04ae40cf1 catch attributeerror to fix upgrade issue 2007-10-23 03:26:28 +00:00
3eacd3e2d6 remove unnecessary eval 2007-10-23 03:10:04 +00:00
7d680bdd3a ratio fix 2007-10-23 02:43:21 +00:00
79e9e1de53 fixed issue when calling close on an uninstantiated variant_stream + variant_stream cleanup (removed unncessesary templates) 2007-10-22 23:56:03 +00:00
5d4a69d852 lt sync 1688 2007-10-22 22:33:08 +00:00
2e5eb2b885 try to fix a race condition 2007-10-22 20:35:32 +00:00
f2c036650c fix deleting of subfolders 2007-10-21 00:51:13 +00:00
0b4b409a53 fix edited tracker list not being persistent 2007-10-20 23:37:36 +00:00
58be40da1e set some fields as insensitive which arent valid on win32 2007-10-18 23:25:26 +00:00
589c007386 windows tweaks to prevent error on win32 2007-10-18 23:15:52 +00:00
c70721aeac fix for some invariant checks 2007-10-18 06:19:20 +00:00
1ddbf05b92 set file browser fields in deluge's preferences insensitive when in win32 2007-10-17 03:17:59 +00:00
cc77df8216 make torrentfile pref field insensitive when on win32 to avoid confusing windows users 2007-10-17 03:12:26 +00:00
5fb1987b1b collect network information when not in the networkgraph plugin tab 2007-10-17 02:54:05 +00:00
aef72f74a2 2007-10-16 17:05:25 +00:00
3dc0b25876 win32 translations fix 2007-10-16 16:48:26 +00:00
d07d25e189 fix fastresume oops 2007-10-16 02:26:49 +00:00
664877a7e6 update changelog 2007-10-16 01:23:29 +00:00
9d75b5f306 fix fastresume 2007-10-16 01:18:08 +00:00
891a9955ad oops value switch 2007-10-16 01:13:58 +00:00
8444cb852c have thread/process selection inactive until fixed. now we automatically choose which method based on platform 2007-10-16 01:12:50 +00:00
20f580014b sync lang 2007-10-15 21:21:26 +00:00
382f4b0f1a remove no longer needed alert 2007-10-15 19:37:17 +00:00
8f030fb112 fixed issue with failing async_accept on windows 2007-10-15 19:34:24 +00:00
1690fd846b intrusive_ptr_base fix 2007-10-15 18:09:24 +00:00
871d0d15c6 fix webui kill if already running 2007-10-15 17:03:46 +00:00
27d7e80658 clarify popup message 2007-10-15 15:50:24 +00:00
dad79748fa catch exception in last 2007-10-15 15:02:56 +00:00
3169b460f0 remove fastresume after adding torrent that's not a seed 2007-10-15 13:22:27 +00:00
b403530fab fast reconnect fixes 2007-10-15 05:34:32 +00:00
7d98d49803 account for xp, which has a higher half-open allotment 2007-10-15 01:53:42 +00:00
f20d0485c3 windows sucks. vista home has a limit of 5 half-open connections, so we set our windows limit to 4 to be save 2007-10-15 01:40:37 +00:00
3fd9a0dc05 fix links/enclosures 2007-10-15 01:36:32 +00:00
715874df58 tweak last 2007-10-15 00:20:48 +00:00
87fe5fe4ad fix start/stop 2007-10-15 00:14:01 +00:00
b6dd803a95 really kill 2007-10-14 23:26:55 +00:00
30b5967f12 if already running on init, kill 2007-10-14 23:07:20 +00:00
f54f2a50ec make default run in thread if in windows and default not in thread if not in windows 2007-10-14 21:48:40 +00:00
3947a75336 fix module error 2007-10-14 20:27:32 +00:00
71a5c79c15 tweak another total_done to total_wanted_done 2007-10-14 19:47:56 +00:00
dbe83d4ede make sure we only accept folders as plugins 2007-10-14 17:35:08 +00:00
375a7fdc64 Fix CONFIG_DIR issues on windows when ~ does not expand. 2007-10-14 13:42:58 +00:00
528e8c7625 rename up/down limits 2007-10-14 05:53:50 +00:00
b612f3663f re-add ratio to todo 2007-10-14 05:49:24 +00:00
ce8e47fae3 apply scheduler prefs onload 2007-10-14 04:51:05 +00:00
e4f5d822de use total_wanted instead of total_size in checking free space 2007-10-14 04:46:11 +00:00
20ffbf122e remove plugins and preferences from tray menu 2007-10-14 04:31:06 +00:00
7585642a98 apply_prefs in locations plugin 2007-10-14 04:08:16 +00:00
fe67907a5d add progress bars to files plugin - yobbobandana 2007-10-14 03:55:53 +00:00
7fa861f83a update changelog 2007-10-14 02:38:02 +00:00
0a6d638c59 add popup warning for clear :p 2007-10-14 02:34:57 +00:00
c14d4dd23a rename clear button 2007-10-13 23:33:26 +00:00
0eb88197c7 use libtorrent to remove files, which solves the problem of us deleting files that werent part of the torrent and other minor issues 2007-10-13 23:23:44 +00:00
a7868ed3fd revert upload memory change for now 2007-10-13 18:30:12 +00:00
a1d757dfbf tweak default path 2007-10-12 20:48:47 +00:00
1251a671bd add missing bracket 2007-10-12 18:39:04 +00:00
6e4528875e scheduler todo 2007-10-12 16:59:31 +00:00
734fa157b4 fixed so that peers only get one fast-reconnect 2007-10-12 01:30:10 +00:00
370578119e hopefully fix 'losing' port in windows 2007-10-12 00:35:05 +00:00
3a23ad301a asio sync 2007-10-11 19:22:07 +00:00
8687aab7b6 association done 2007-10-11 18:05:34 +00:00
81861afa64 windows association 2007-10-11 06:11:48 +00:00
30d357d797 save uploaded_memory every minute 2007-10-11 03:47:40 +00:00
106e98a15b new 0.5.x todo file 2007-10-11 03:28:23 +00:00
991467790b fix indent oops 2007-10-10 19:49:45 +00:00
5a813106ba fix typo 2007-10-10 19:43:03 +00:00
daaa79360a fix priority...hopefully 2007-10-10 16:26:19 +00:00
dabe429108 tooltip tweak 2007-10-10 05:11:29 +00:00
ff2483af90 parole mode improvement. Doesn't clear out the request queue when choked by a peer on parole anymore 2007-10-10 02:39:01 +00:00
a45c49d037 fix deconstructor order issue 2007-10-10 02:14:01 +00:00
a54432d0cf again 2007-10-10 02:06:13 +00:00
8464c9c0f6 small tweak to deluge_core max_half_open 2007-10-10 02:03:34 +00:00
94ca1789d5 add max half-open connections 2007-10-10 01:56:05 +00:00
7196070f59 updating changelog 2007-10-10 01:29:08 +00:00
bd02f837bb first attempt at switching over to new storage allocation 2007-10-09 21:22:42 +00:00
4ff8458b3f tweak file manager drop down 2007-10-08 21:21:52 +00:00
4de4fce8ec another vista try 2007-10-08 19:24:31 +00:00
ad239210dd stderr/stdout win32 2007-10-08 16:57:00 +00:00
4892cf3df2 fix last 2007-10-08 16:37:32 +00:00
df158d88cb tweak again 2007-10-08 03:41:06 +00:00
a0031240fb fix tooltip 2007-10-08 03:33:53 +00:00
54f0e6b91f fixed dead lock and fixed a problem in recent shutdown cleanup 2007-10-07 23:54:04 +00:00
a21b852e07 multiple sizes in ico file 2007-10-07 23:45:01 +00:00
fc12ade03a account for '-1', oops 2007-10-07 22:47:24 +00:00
1addf2541a speedlimiter fixes 2007-10-07 22:38:28 +00:00
d8482a3fc9 better shutdown sequence in lt 2007-10-07 21:03:25 +00:00
bf8727f7bf webui rev-80 2007-10-07 04:56:01 +00:00
278c6c9f3e fixes files that were left open in write mode by mistake, policy invariant check fix, fixed static assert being hit 2007-10-07 03:41:56 +00:00
cd175ebe9a libtorrent build fix 2007-10-06 17:32:41 +00:00
5541700881 increase width a little so larger fit a bit better 2007-10-06 05:37:54 +00:00
19621315c6 lt sync 1649 2007-10-06 04:22:06 +00:00
1489ef5bc0 i need coffee 2007-10-05 21:29:29 +00:00
a335153e0e rename error 2007-10-05 21:25:48 +00:00
a90069b5d0 backslashes should not be needed, since the we're using expanduser in conjunction with specifying a dir ('deluge') after it 2007-10-05 21:22:56 +00:00
24fbfccfb0 webui-rev73 2007-10-05 21:16:46 +00:00
20d63448cb webui rev 57 2007-10-04 21:49:29 +00:00
b8a8757076 fix storage of banned peers lt 1645 2007-10-04 21:14:32 +00:00
c80a2e822b lt 1643 2007-10-04 15:31:23 +00:00
d6fb920382 accidentaly reverted disk io priority fix, so here it is again 2007-10-04 00:09:45 +00:00
4e5a6d61dc moved block_downloading_alert, block_finished_alert and piece_finished_alert to debug level...yay performance 2007-10-04 00:07:26 +00:00
53f4a55711 disk io priority fix 2007-10-03 22:46:30 +00:00
3273dddb8a fix http connection and storage bug 2007-10-03 22:24:22 +00:00
d55fff555c storage fix 2007-10-03 18:33:32 +00:00
9ed93af6b2 handles case where a request in the allow fast set is rejected and saves banned peers in resume data 2007-10-03 18:08:17 +00:00
b2ae9f1db1 revert last webui 2007-10-03 02:40:30 +00:00
3211dc9019 fixed potential race condition when removing a torrent that was just added 2007-10-03 01:58:50 +00:00
8fa2f73434 webui rev 64 update 2007-10-03 00:05:09 +00:00
5cda3e71fa fix policy bug 2007-10-02 23:09:04 +00:00
a101b4c1c9 policy now has a map of peers instead of a flat list, makes it more efficient to do lookups 2007-10-02 19:58:10 +00:00
13a0630875 windows fixes for lt 2007-10-01 22:56:48 +00:00
7b5fb39d7f fix for boost 1.33.1 in last commit 2007-10-01 08:59:16 +00:00
2e0d50407b lt sync 1623 2007-10-01 08:46:09 +00:00
e833a2d75e remove regex dep since asio requirement for it has been removed 2007-10-01 07:31:04 +00:00
190a2de73e remove unneeded asio files 2007-10-01 07:30:20 +00:00
563c437675 add new boost regex dependency 2007-10-01 07:18:48 +00:00
5bb79f682c update list of files to be translated 2007-10-01 06:09:08 +00:00
107b044fba remove invalid inline 2007-10-01 02:23:38 +00:00
fa9bf5afc8 add valid fast check 2007-10-01 02:20:03 +00:00
fd7140b15e add key and unlimited notice 2007-10-01 01:45:33 +00:00
6445d1cc26 tweak glade file 2007-09-30 23:48:39 +00:00
2e398cb212 fix scheduler plugin 2007-09-30 22:27:08 +00:00
47fe9bd11f set parent for add torrent dialog 2007-09-30 21:13:37 +00:00
b9f543682b remove unneccessary import 2007-09-30 19:56:34 +00:00
3de1cb9938 sync lt and asio 1615 and upload version # of plugin 2007-09-30 18:32:19 +00:00
c0d8bf2d7f fix tray password resetting itself sometimes 2007-09-30 09:12:38 +00:00
999e18e4be update changelog 2007-09-30 08:54:09 +00:00
45f5fef825 encrypted passwords for tray lock with backwards compatibility for old method to ease upgrade 2007-09-30 08:52:56 +00:00
5d62060bd8 sync webui to rev56 2007-09-30 08:20:14 +00:00
b16930ea4c clean up adding via url and make enter submit it instead of having to click ok 2007-09-30 03:49:30 +00:00
1d8b9cb402 fix windows_check() 2007-09-29 07:01:26 +00:00
53e65e9554 sync webui plugin with rev48 2007-09-29 06:39:06 +00:00
9a050065a9 - 2007-09-28 01:50:21 +00:00
72d868ff79 WebUi Plugin - rev40 2007-09-28 01:47:12 +00:00
d36ec723ac modification to setup.py to allow for subdirs in plugins 2007-09-28 01:45:17 +00:00
0858836a67 modification to setup.py to allow for subdirs in plugins 2007-09-28 01:45:03 +00:00
b02ef923ff again 2007-09-27 16:26:44 +00:00
918da976cb explorer fix 2007-09-27 16:24:40 +00:00
c4b5101189 patch for slurdge 2007-09-27 14:40:39 +00:00
e74c62d307 handle launching explorer on windows a bit better 2007-09-27 07:56:28 +00:00
283f30f884 add double-click torrent to changelog 2007-09-27 03:55:22 +00:00
691cf5b34f double-click on torrent opens up containing folder and fix about dialog 'bug' on windows 2007-09-27 03:54:12 +00:00
e4effa22b1 fix enc level order 2007-09-27 03:01:25 +00:00
ed33fa1eb6 update changelog 2007-09-27 01:40:27 +00:00
c1d3fbc3f3 deal with windows systray limitation 2007-09-27 01:25:18 +00:00
2738bb2835 remove wrong space 2007-09-26 21:46:11 +00:00
71809e968c use cPickle 2007-09-26 20:19:18 +00:00
8b35caa3c8 country fix 2007-09-26 20:15:46 +00:00
2c1bed04ca Revert last commit. Did not build. 2007-09-26 11:18:34 +00:00
6bcafc02e3 country optimization 2007-09-26 07:13:04 +00:00
5d4931c94b save fastresume on pause 2007-09-25 21:07:12 +00:00
9ac92ca982 remove fastresume file when a torrent is unpaused 2007-09-25 21:02:22 +00:00
8a723474ed bdist_rpm fixes 2007-09-25 19:32:56 +00:00
4d05a9dfc9 temp fix to prevent plugin from crashing deluge 2007-09-25 15:36:14 +00:00
c3e960aa86 fixes problem with torrents that have a name.utf-8 entry 2007-09-24 19:38:27 +00:00
33a99c140e Change directory to that of the .exe if in Windows. 2007-09-24 10:37:14 +00:00
44240b194e lt tracker request url ampersand fix, endpoint to string conversion fix. 1602 2007-09-23 23:45:41 +00:00
b209d268f2 fix icon path 2007-09-23 08:18:20 +00:00
f5868df3ad ipv6 fix, race condition fix, varient_stream fixes 2007-09-22 17:50:59 +00:00
f62bf99941 fix various py_none returns 2007-09-21 20:29:40 +00:00
ddc1ee6295 enum fixes and ipv6 update 2007-09-20 16:28:41 +00:00
f673833fe9 proper path to try to fix windows bug #6 2007-09-19 21:01:06 +00:00
cd10e9bbaa many fixes in libtorrent sync 1586 2007-09-19 20:39:29 +00:00
760acc8f30 more asserts to bandwidth limiter 2007-09-19 02:45:29 +00:00
25146891ff disable loopback for upnp 2007-09-18 02:33:04 +00:00
a93c236e0e libtorrent upnp fix, compilation fix 1577 2007-09-17 19:48:16 +00:00
4fbef5d94a update changelog 2007-09-17 10:36:41 +00:00
2037ceba69 again, to prevent upgrade problems, disable torrentpieces from being shown as available 2007-09-17 10:36:09 +00:00
3e5ad3e60d disable torrent pieces plugin from loading to prevent upgrade problems now that its been removed 2007-09-17 10:30:29 +00:00
a026f0472d update changelog 2007-09-17 10:24:42 +00:00
9d85580029 pause torrent before move and resume afterwards 2007-09-17 09:55:48 +00:00
e4e4ded874 move pause code in blocklist plugin 2007-09-17 03:56:42 +00:00
dcfb14d7e5 piece picker fix 1568 2007-09-17 01:13:06 +00:00
3f89fd2753 libtorrent sync 1567, for many fixes, including upnp and run conditions 2007-09-16 07:56:11 +00:00
2e461091dd clean up statvfs 2007-09-15 15:51:19 +00:00
82e7eb2e32 Add licenses for libtorrent and asio. 2007-09-15 07:21:34 +00:00
444ac9ec99 add windows notice 2007-09-14 22:42:07 +00:00
36cd2cda98 again 2007-09-14 22:30:00 +00:00
389f9d94a2 fix last, oops 2007-09-14 22:27:36 +00:00
63e4724a8c add warning for failed launch in win32 2007-09-14 22:23:38 +00:00
dc71d16ac1 add try/except for startfile 2007-09-14 22:18:06 +00:00
491e7ea0d6 window tweak for torrentfiles 2007-09-14 22:13:09 +00:00
da60769933 windows tweaks 2007-09-14 22:09:44 +00:00
ccf5f91dc2 again 2007-09-14 19:28:06 +00:00
05b105276e tweak last 2007-09-14 19:26:29 +00:00
eb7db72965 try to catch windows shutdown so we exit properly and dont lose data 2007-09-14 19:21:55 +00:00
47cac3dc4a add basic vista support 2007-09-14 19:08:01 +00:00
c1e4364c1d i like pie 2007-09-14 18:29:57 +00:00
7ad2b9ec6a change for building on windows 2007-09-14 18:26:53 +00:00
4bc18ed940 Fix deprecated add_torrent() method call. 2007-09-14 06:53:24 +00:00
ff073dc4fb fix race condition (rev 1561) 2007-09-14 03:09:05 +00:00
b7f0447228 reupping asio and some lt fixes 2007-09-12 22:43:51 +00:00
b0fdc2fab8 upnp on by default 2007-09-12 22:11:50 +00:00
c857b1fbbf upnp fixes 2007-09-12 21:37:33 +00:00
08ea29aa4c only kill our daemon, not potentially others...unlikely as it may be 2007-09-12 20:55:51 +00:00
0d356ff79a peers and files on my default 2007-09-12 03:14:41 +00:00
bd5cd655a1 remove torrentpieces. blah 2007-09-12 02:55:51 +00:00
116c79ba3f cleanup and kill dbus-daemon on close when in win32 2007-09-12 01:42:37 +00:00
63501ebe5b increase the maximum buffer size on bottled http_requests 2007-09-11 22:37:58 +00:00
f4bd67c320 pause torrents during blocklist loading and then resume the ones that werent paused to begin with 2007-09-11 21:55:49 +00:00
d793835a7e add try/except to catch crash if the plugin configuration window is closed 2007-09-11 21:27:50 +00:00
120b3335b4 tweaks so torrentnotification plugin doesnt crash win32 client 2007-09-11 19:20:41 +00:00
4c5a53b982 cut unnecessary import 2007-09-11 01:16:29 +00:00
ca4305c0a9 cleaning up win32 calc_free_space 2007-09-11 01:13:17 +00:00
c2b3109d0a make calc_free_space work with win32 2007-09-10 23:13:21 +00:00
f880a05e14 again 2007-09-10 21:26:21 +00:00
fd5f99630f fix last 2007-09-10 21:24:17 +00:00
5929d1ad53 install path for windows 2007-09-10 21:22:10 +00:00
c6cb4a20c8 listen port refactoring 2007-09-10 20:52:42 +00:00
c2b9a5eaaa listen port tweak 2007-09-10 17:15:48 +00:00
dcf3cac453 clarify lack of svg use in win32 2007-09-10 17:00:04 +00:00
aef7f31f5c changelog updates 2007-09-10 16:44:44 +00:00
6064706d6c windows build touchups 2007-09-10 16:44:35 +00:00
f2e78f407c freebsd build fix 2007-09-10 16:44:04 +00:00
10a34b0951 deal with windows icons 2007-09-10 09:59:12 +00:00
f7039bdc0a i need sleep 2007-09-10 09:23:36 +00:00
aff7718e21 add ico to ease future packaging 2007-09-10 09:21:25 +00:00
889a025396 add file 2007-09-10 09:19:41 +00:00
1ef898ba37 add missing file 2007-09-10 08:52:32 +00:00
9a18581b20 merge in win32 changes to setup file 2007-09-10 08:51:21 +00:00
8b7419eb51 set half open connections to 8 on windows 2007-09-10 08:48:18 +00:00
02720ddcd9 libtorrent various fixes including upnp 2007-09-10 06:46:41 +00:00
47e47ac9cc use theme for tray icon, not hard-coded 2007-09-09 20:46:59 +00:00
93f928baac update dependencies 2007-09-09 16:02:52 +00:00
af4c9c0ea8 Updated Scheduler plugin to work with current trunk. 2007-09-09 12:07:20 +00:00
8142c69e2a Revert last change as it doesn't seem to fix the issue. 2007-09-09 12:03:03 +00:00
f164cfd2cb Fix issue of port not being closed properly on exit. 2007-09-09 11:31:09 +00:00
af177749ff icon revamp for freedesktop.org specs and to use svg instead of png inside deluge 2007-09-09 01:06:29 +00:00
1abb7c161d session_impl and connection_queue fixes 2007-09-08 19:05:43 +00:00
1b6a8925eb tweak for win python bug 2007-09-08 18:47:31 +00:00
a91c00c247 move explorer to end of list to not mess up current pref settings 2007-09-08 01:32:35 +00:00
cfe44a3ad9 add ms explorer to file manager list 2007-09-08 01:30:03 +00:00
eac5b42336 remove no longer needed exec_deluge_command 2007-09-08 01:03:34 +00:00
f5951ef7b7 move update.py to common 2007-09-08 01:00:51 +00:00
83474930fd touchup 2007-09-07 22:21:05 +00:00
3aedc14399 move send info into common 2007-09-07 21:26:50 +00:00
de0f454879 use thread for browser calls 2007-09-07 21:02:22 +00:00
20bbb09f4f locales tweak 2007-09-07 09:38:53 +00:00
e8e6f5bd4b hide tray icon on close for the benefit of windows 2007-09-07 06:31:09 +00:00
58bcb2abb9 ticket #520 switch LC_ALL to LC_MESSAGES 2007-09-06 20:48:22 +00:00
402bd70816 asio sync with upstream 2007-09-06 20:27:50 +00:00
f8029692bf windows locale skipping 2007-09-06 20:07:12 +00:00
2ffbbe1eb8 more piece picker fixes for libtorrent 2007-09-06 19:36:40 +00:00
5c072322e3 piece picker fixes in libtorrent 2007-09-06 01:36:16 +00:00
5b57463125 remove incorrect assert 2007-09-05 22:50:57 +00:00
63621be3ee add private flag to torrentcreator 2007-09-05 17:35:44 +00:00
87d58cd0e1 firstlast fix by andar 2007-09-05 13:25:46 +00:00
1914cbea3e remove unneeded try 2007-09-05 01:43:55 +00:00
83042205ab pref for show 18px flag on by default 2007-09-05 01:29:59 +00:00
899dd558c9 libtorrent sync 1531 and alter deluge_core to deal with api changes in libtorrent 2007-09-04 19:51:15 +00:00
d7363ffb5f path fix 2007-09-04 18:12:16 +00:00
26dd7a83cf win config dir touchup 2007-09-04 16:57:04 +00:00
1ac7e0eaab prio range fix from andar 2007-09-04 16:40:40 +00:00
692cd471f1 xdg.BaseDirectory fix for windows 2007-09-04 16:34:58 +00:00
11f033db48 revert last until further testing 2007-09-04 07:13:06 +00:00
0e3f5672a5 libtorrent sync 1531 2007-09-04 04:01:19 +00:00
f1fde2dcf0 if statement for sighup in win32 2007-09-04 01:09:15 +00:00
9af94bda88 Fix typo in Wizard: 10mbit should have read 100mbit. 2007-09-03 11:33:27 +00:00
3f60aa4c73 changing version number of trunk to reflect next release 2007-09-03 09:16:00 +00:00
a636cfc4e0 redo last properly 2007-09-03 06:45:37 +00:00
fa8b04d0a1 sync language with launchpad for rc release 2007-09-03 06:42:52 +00:00
a33294eead add path to details tab 2007-09-03 06:26:54 +00:00
28dbb279a0 revert 1607 2007-09-02 22:57:25 +00:00
af37e0a361 peer/seed numbers cleanup - andar 2007-09-02 19:38:23 +00:00
ba3ff0877f only show pref dialog once 2007-09-02 03:07:26 +00:00
4cc1e0e96b fix auto max ratio - micah 2007-09-02 00:24:44 +00:00
e0937ab97a correct wording 2007-08-31 19:42:12 +00:00
782457d8d7 file and peer plugins on by default and change upload slots 2007-08-31 19:29:57 +00:00
547766cdf9 tweak queue bottom 2007-08-31 07:13:43 +00:00
6253d68e3f remove unnecessary print 2007-08-30 07:41:18 +00:00
c3bdbb59e7 touchups 2007-08-30 02:16:20 +00:00
462ad22c61 cleanup 2007-08-30 02:04:26 +00:00
fc5af09660 tweak changelog 2007-08-30 01:17:53 +00:00
7c563d92ed reorderable tabs and remember order 2007-08-29 21:38:38 +00:00
26f1970d6c adding copyright for all missing plugin files 2007-08-29 10:16:33 +00:00
b4dfd8ea5b fix line break 2007-08-29 08:51:42 +00:00
d1d0cad3fb copyright fixes 2007-08-29 08:37:38 +00:00
5aac66bb25 missing part of last commit 2007-08-29 07:09:02 +00:00
99e8f71246 edit trackers now persistent 2007-08-29 07:08:16 +00:00
8930d69df1 wizard cosmetic touchup 2007-08-29 04:56:53 +00:00
14ed3ebac3 change version number for rc prep 2007-08-29 02:28:10 +00:00
ebbf457ce5 persistence to changelog 2007-08-29 00:55:37 +00:00
e274a60373 desiredratio persistence 2007-08-29 00:53:00 +00:00
42d36e54de move persistence data so it's made before building the menu 2007-08-29 00:40:46 +00:00
d39e691c7a fix missing value 2007-08-29 00:38:34 +00:00
ee9a01ab6d more speedlimiter persistence fixes/tweaks 2007-08-28 23:38:58 +00:00
6bcd0ca604 webseed plugin persistence 2007-08-28 23:23:05 +00:00
d2761b1603 fix for old torrents 2007-08-28 23:19:09 +00:00
fae29ee8be persistence for speedlimiter 2007-08-28 23:05:08 +00:00
8e2ea90c82 cleanup line-lengths for pep8 2007-08-27 22:14:17 +00:00
dac78171aa tweak proxy tab 2007-08-27 21:29:10 +00:00
39a66dd94b add deluge logo to wizard header 2007-08-27 21:14:40 +00:00
3aeb01f38b move tabs to top 2007-08-27 19:19:23 +00:00
dd88d29f87 bunch of lt fixes 2007-08-27 19:04:41 +00:00
b39f981f6d tweak last 2007-08-27 09:14:11 +00:00
3608775441 fix lt bug #126 and some duplicate data from torrent_info 2007-08-27 09:10:29 +00:00
a71a6b8e1a add run configuration wizard to help menu 2007-08-27 06:39:00 +00:00
e0442949b2 touchup plugin descriptions 2007-08-27 06:03:16 +00:00
92c96a9a90 piece picker bug fixes and removed expensive invariant checks 2007-08-27 05:44:12 +00:00
b50e1775f0 close file properly 2007-08-27 01:36:45 +00:00
d5b355f807 tweak width a little 2007-08-27 01:09:51 +00:00
770ebe63bf add notice that proxy settings need a restart to become effective 2007-08-27 00:35:31 +00:00
e01ac4c846 bandwidth limiter asserts 2007-08-26 23:49:57 +00:00
b38fd29eae fix proxy settings not being saved properly 2007-08-26 23:31:04 +00:00
77a243abf3 translation sync 2007-08-26 22:04:07 +00:00
909ba1a1d0 add wizard.glade to translation 2007-08-26 21:51:31 +00:00
43fdce15c8 password lock fix to changelog 2007-08-26 21:45:23 +00:00
2ebfa02a11 fix password locking 2007-08-26 21:03:33 +00:00
d4b79ec6f7 have plugin button go to plugin tab in preferences dialog 2007-08-26 20:47:59 +00:00
22390d96dd go back to not blocking torrents during import 2007-08-26 19:59:04 +00:00
cd4c775d2f changelog updates 2007-08-26 19:50:59 +00:00
8fe5b570d1 fix spacing 2007-08-26 19:30:36 +00:00
0e470b9dda fix path 2007-08-26 19:08:34 +00:00
7be512656c pause torrents during import 2007-08-26 07:24:11 +00:00
63bd654c86 code cleanup - 9.55/10 2007-08-26 07:09:49 +00:00
ca89e7d18e add copyright 2007-08-26 06:23:06 +00:00
bcaec81edd add wizard for first time setup 2007-08-26 06:18:11 +00:00
91b6f6b26f tweaks to last commit 2007-08-26 02:03:17 +00:00
4238ac91a3 try to prevent "lost data" by removing previous fastresume file prior to creating another 2007-08-26 01:59:00 +00:00
d071961473 lt bug fixes #1502 and #1500 2007-08-25 22:43:36 +00:00
441c4de1e3 rate limiter fix from lt 2007-08-23 16:55:25 +00:00
46942d15dc fix queue bug. oops 2007-08-23 03:06:43 +00:00
54a61c8695 only try to fix dht corruption once 2007-08-23 02:26:09 +00:00
575c6f5e4f fix pause, piece picker, and bandwidth limit bugs 2007-08-23 01:48:21 +00:00
ae37b3aa39 libtorrent add torrents in paused state sync 2007-08-22 07:17:21 +00:00
da43f105b8 remove old plugin_manager glade file 2007-08-22 02:35:28 +00:00
4e7f2b0cd3 we crash on < 2.9 anyway, so this stupidtray isnt needed and thus being removed 2007-08-21 23:07:20 +00:00
730435c032 fix typo 2007-08-21 22:10:55 +00:00
accd178572 fix bug that caused StupidTray to be used 2007-08-21 11:41:57 +00:00
9a5db01700 Fix typo in MoveTorrent plugin. 2007-08-21 10:28:04 +00:00
d36298f2cf fix lt bug #136 2007-08-21 08:30:37 +00:00
cd7427f54d update inclusion of files to be translated 2007-08-21 02:57:46 +00:00
b868bc8d05 add plugin manager out to changelog 2007-08-21 01:32:55 +00:00
3a1c89cc48 touchup to plugin tab 2007-08-21 00:59:53 +00:00
4bea6f98ae plugin manager integrated into preferences 2007-08-21 00:50:04 +00:00
8d33015ef4 have interactive_add return unique_id 2007-08-20 19:57:27 +00:00
5e7329026e last commit accidentaly included a couple of other changes i was working on. reverting those to have only one change per commit 2007-08-20 02:31:42 +00:00
4d2a2dd604 move "move completed downloads" into the "move torrent" plugin 2007-08-20 02:28:51 +00:00
c58331f5e6 move torrent plugin 2007-08-19 23:16:10 +00:00
4897a9b038 choked fix 2007-08-19 08:55:33 +00:00
4164f15735 initial libtorrent sync 1466 2007-08-19 07:46:55 +00:00
7f2232f34f swap plugins and preferences in menus to be consistant. ticket #499 2007-08-17 23:03:31 +00:00
40f9b0a7d0 Sync _dbus.py from deluge-plisk branch. 2007-08-17 09:01:26 +00:00
dd64eda432 little cleanup of width setting and saving 2007-08-17 03:44:32 +00:00
1973d7c9e3 revert last...too many changes for now 2007-08-16 23:49:18 +00:00
476a72b0e4 1456 libtorrent sync 2007-08-16 21:06:27 +00:00
c1d2d4f0ae Per torrent preferences tweaks. 2007-08-16 07:30:09 +00:00
c9ba1cd207 require there to be active torrents for dht checking to take place 2007-08-16 01:35:43 +00:00
00a88b0ff1 destroy deluge window before doing rest of shutdown sequence so users dont kill deluge thinking it's hung 2007-08-15 07:22:10 +00:00
61b111661e move file column width into preferences 2007-08-15 06:17:54 +00:00
f8c6151568 Tweaks to peers tab columns. 2007-08-15 05:11:18 +00:00
23a2111650 fix files columns 2007-08-15 04:57:50 +00:00
70e4b2d9ed Added copyleft to _dbus.py. 2007-08-15 04:56:59 +00:00
b77f5c1c25 fix columns in peers plugin 2007-08-15 04:52:51 +00:00
c5cbc29705 fix toggle column 2007-08-15 04:39:04 +00:00
56f5e7b7d5 add save column widths to changelog 2007-08-15 04:12:51 +00:00
79ed86f0e7 save column widths 2007-08-15 04:12:21 +00:00
b89f320d26 Remember last chose download directory when "Ask where to save each download"
is selected.
2007-08-15 03:13:04 +00:00
4f697de7f3 blah. add self. 2007-08-15 02:53:40 +00:00
bb1f887a12 set timer back to zero when done...forgot that :) 2007-08-15 02:52:22 +00:00
d885d3320a try to detect a corrupted dht file and automatically fix it 2007-08-15 02:51:25 +00:00
f195c3c680 add fast to changelog 2007-08-15 02:14:38 +00:00
e9605a8432 Show seeding icon next to finished(with filtered files) torrents. 2007-08-14 22:56:37 +00:00
62c369bb6f Set desired ratio to 1.0 by default for all torrents. 2007-08-14 21:55:47 +00:00
274ba7e771 Fixed typo in Speed Limiter plugin. 2007-08-14 21:03:07 +00:00
14a57c6d00 add checking for url in web seed plugin 2007-08-14 19:21:00 +00:00
8238605aa4 add web seed plugin to changelog 2007-08-14 19:18:33 +00:00
1a3b381164 small fix for last 2007-08-14 19:17:00 +00:00
751dc5bf2b add web seed plugin 2007-08-14 19:16:47 +00:00
8b4d40664e add web url to our bindings and core 2007-08-14 18:46:57 +00:00
b26575e920 fast-extension support from libtorrent 2007-08-14 17:59:02 +00:00
1800dbad86 add payload 2007-08-14 15:01:09 +00:00
44772f9d11 Added queue fixes to ChangeLog. 2007-08-13 22:37:01 +00:00
912eb0e14c Tweaks to wording in a comment from prev commit. 2007-08-13 20:38:13 +00:00
6207033b36 More queue fixes. Now store torrent_info instance in the queue instead of
unique_id as there is no sense to store unique_ids in the persistent queue
while uqique_ids is changed on each restart. In the core self.state.torrents
now a dict with torrent_info -> unique_id. Needs testing.
2007-08-13 20:33:08 +00:00
72fa2a44a5 Refactored the way dbus is imported. 2007-08-13 11:10:15 +00:00
3edd3280ae Properly restore queue order on restart. 2007-08-13 09:09:15 +00:00
aea7be5aa5 fix typo 2007-08-13 08:45:31 +00:00
77a88d9797 add license to about dialog 2007-08-13 08:42:37 +00:00
19c75c10c8 use payload for session total downloaded and total uploaded 2007-08-13 05:40:48 +00:00
4af848ef49 we should've been using payload for transfer speeds from the get-go 2007-08-13 05:29:24 +00:00
952f03a6cc revamp networkgraph plugin - Ultrafusion 2007-08-12 23:23:21 +00:00
da8bd07ce7 libtorrent sync 1449 2007-08-11 22:55:15 +00:00
ed9a306cf5 Removed some unused interface code. 2007-08-11 03:06:56 +00:00
ef81832120 Tweaks to tray code. 2007-08-11 01:24:51 +00:00
1372b3fc67 Replaced --tray command option with "Start in tray" preference. 2007-08-11 01:18:50 +00:00
9ae50f72d9 Tweaks to plugins tray messages. 2007-08-11 00:20:21 +00:00
371e1f9a54 Tweaks to Extra stats plugin. 2007-08-11 00:09:22 +00:00
db4ef67cff Get not cached torrent state in core.apply_queue(). 2007-08-10 22:42:53 +00:00
038a1dc316 last changes in changelog for 0.5.4.1 2007-08-10 21:40:15 +00:00
bcb03beffd Tweaks to allocation and file manager prefs. 2007-08-10 21:32:20 +00:00
c29a303dd4 fix switch 2007-08-10 21:21:58 +00:00
8bb4ea33aa update for new prefs 2007-08-10 21:18:59 +00:00
a349e5e6b9 compact/full and manager prefs tweak 2007-08-10 21:17:32 +00:00
ee074874fa fix typo 2007-08-10 21:02:05 +00:00
59f39ce65c fix weird radio group assertion error 2007-08-10 20:59:58 +00:00
33718d5e03 Show warning when external commands not found. 2007-08-10 20:58:44 +00:00
2a09f50ecb add full allocation to preferences so users arent confused thinking that we dont support it 2007-08-10 20:55:08 +00:00
23e5e588e9 language sync with launchpad for release 2007-08-10 20:12:15 +00:00
56f29c89c4 Set date of the 0.5.4.1 release. 2007-08-10 20:11:25 +00:00
bcdc02693e add extra stats plugin to translation and remove old alltime plugin 2007-08-10 20:10:06 +00:00
a8024bad30 version number bump for release 2007-08-10 19:58:35 +00:00
d51a674490 Tweaks to default file manager. 2007-08-10 19:28:46 +00:00
a011e939c9 Try 2 to fix per torrent preferences after resume. Do it in deluge's core for
now, not in libtorrent.
2007-08-10 15:51:31 +00:00
e624334b6a Wording fixed. 2007-08-10 14:59:31 +00:00
ea2592b42b Re-applied patch to fix files timestamps changing when seeding. It was removed
in [1425] and sync with libtorrent r1442 didn't fix that issue.
2007-08-10 14:36:54 +00:00
2c7463f9c3 remove debug print 2007-08-10 09:21:58 +00:00
9934635fed revert 1420 since it broke resuming torrents 2007-08-10 09:17:52 +00:00
ec579fe2d9 xdg-open is default for file manager 2007-08-10 08:16:37 +00:00
28ad94ea6e libtorrent sync 1442 2007-08-10 06:22:28 +00:00
51376bd2be Ask user to set his file manager in case he didn't set it yet when trying to
open folder. Based on the patch from eternalswd, thanks.
2007-08-10 03:38:08 +00:00
ff08e28470 Revert last, needs more thought. 2007-08-10 03:23:45 +00:00
b7c3fddf0e Include uploaded_memory in pickle_state(). 2007-08-10 03:18:25 +00:00
cc20a34906 Replaced All time stats plugin with Extra stats. Patch is from eternalswd,
thanks.
2007-08-10 01:38:33 +00:00
069ebf0228 Locally patched libtorrent to not reset per torrent preferences on each
resume(). See ticket #118 in libtorrent's trac.
2007-08-10 01:15:48 +00:00
c4d1415f40 Tweaks to pause all and resume all features. 2007-08-10 00:15:38 +00:00
55e637eda4 Spacing. 2007-08-09 23:35:19 +00:00
ff64068c6d Refactored the way external commands are called. 2007-08-09 23:33:16 +00:00
1e00b4f0a8 Open files in the files tab by double click. Patch is from eternalswd, thanks. 2007-08-09 21:30:47 +00:00
efe6ffec1c Tweaks to prev commit. 2007-08-09 19:52:40 +00:00
5dafdc95df Tweaks to process open code. 2007-08-09 19:44:38 +00:00
897d394581 Added file viewer preference to Torrent Files plugin. 2007-08-09 18:16:28 +00:00
a3d79bc2a7 PEP8 imports in the TorrentFiles plugin. 2007-08-09 17:01:33 +00:00
12f28e33ae Tweaks to Desktop File Manager prefs. 2007-08-09 16:56:49 +00:00
fe95c9adbc Made "Open folder with" combo box in preferences non editable. 2007-08-09 15:45:40 +00:00
602f12f410 Reverted [1408]. 2007-08-09 15:36:07 +00:00
e98b9f4679 Added link to python-xdg package in the README. 2007-08-09 15:32:33 +00:00
259e43b29a Tweaks to per torrent preferences. 2007-08-09 15:24:54 +00:00
e85a521c43 Removed Open File menu item in the files selection dialog as it's not
applicable there.
2007-08-09 14:57:12 +00:00
4f663d0229 Gracefully handle no network connection in update.py. 2007-08-09 14:32:04 +00:00
14ea39b353 more translation updates 2007-08-09 08:02:02 +00:00
dd1c6615e7 update translation info 2007-08-09 07:47:36 +00:00
cdd2955fbd call me mr consistancy 2007-08-09 07:05:38 +00:00
301d5037cb change alltime to all-time for proper grammar 2007-08-09 06:51:40 +00:00
0dfb43e2ba yeah...those blank lines are just irrtating me 2007-08-09 06:47:54 +00:00
07e50647ce more event logging tweaks -micah 2007-08-09 06:43:26 +00:00
971aa69860 remove extra blank line 2007-08-09 06:16:52 +00:00
56be8825c5 update changelog 2007-08-09 06:03:54 +00:00
4a82620833 remove debug print 2007-08-09 05:59:38 +00:00
62bdd6a12e load blocklist plugin last 2007-08-09 05:58:31 +00:00
e9d8e1b290 fix last commit 2007-08-09 05:49:02 +00:00
245b29f698 all time stats plugin - micah 2007-08-09 05:35:37 +00:00
f4118e9f08 fix icon size 2007-08-09 05:25:20 +00:00
84b1b702c9 make speed dialog more visible and always on top 2007-08-09 04:28:28 +00:00
edc7574a60 make blocklist plugin loading not lock up the UI when the client is just starting 2007-08-09 03:55:56 +00:00
aad2c464e4 Set per torrent prefences on torrent add. 2007-08-09 03:50:32 +00:00
93101340e6 add padding to file manager table 2007-08-09 03:31:37 +00:00
40a1eacc49 better config path settings for eventlogging-micah 2007-08-09 02:19:50 +00:00
cf6443432b add open folder and open file to changelog 2007-08-09 02:14:17 +00:00
ff13d99e99 add separator 2007-08-09 01:52:28 +00:00
7fbbd7da30 add popup-warning if xdg-open is not found 2007-08-09 01:49:23 +00:00
d8d6dcd998 touchup 2007-08-09 01:31:26 +00:00
2d952aaa48 add open file to file_menu 2007-08-09 01:26:33 +00:00
b89120aaa5 Tweaks to core.queue_* functions. 2007-08-09 00:36:22 +00:00
4caa29fddc Pickle state in core.queue_* methods. Idea by eternalswd, thanks. 2007-08-09 00:29:33 +00:00
c2bd8b7ac3 Tweaks to open folder feature. 2007-08-09 00:16:03 +00:00
0053ae4f59 pickle instead of sync in set_user_pause 2007-08-08 23:56:42 +00:00
95d5e33301 add custom option for file manager 2007-08-08 23:03:44 +00:00
fa505b6750 let system env find location 2007-08-08 22:17:27 +00:00
86ce83edb1 fix for multiple selected torrents and open containing folder 2007-08-08 22:11:38 +00:00
4e22511d5a finish revert i hope 2007-08-08 22:06:13 +00:00
b5e898721d fix last 2007-08-08 22:00:23 +00:00
a111d8e648 revert tray tooltip lifetime 2007-08-08 21:58:43 +00:00
2cebfca612 add try to capture possible error 2007-08-08 21:46:47 +00:00
8bd900d189 add "open containing folder" by me and lifetime totals in tray tooltip by micah 2007-08-08 21:45:18 +00:00
5b522678e0 Added new per torrent preferences to ChangeLog. 2007-08-08 20:57:12 +00:00
2f8f89cf18 alignment fixes - micah 2007-08-08 20:18:46 +00:00
b8aafa3448 Changed Availability column name to Avail. so it use a bit less space. 2007-08-08 20:08:15 +00:00
758b5d8851 Added per torrent max connections and max upload slots preferences. 2007-08-08 19:59:46 +00:00
b9a5b1c7a3 Tweaked update.py to properly call gettext function. 2007-08-08 16:56:52 +00:00
69103fdf49 Don't use global preferences in plugins. 2007-08-08 15:13:53 +00:00
c5705b2136 Fixed #485 - Properly set proxy settings. 2007-08-08 14:55:36 +00:00
1573e11acf pieces description update- micah 2007-08-08 06:52:43 +00:00
f55f32ff2a last 2007-08-08 06:37:07 +00:00
2fa11dc18f pieces rewrite - micah 2007-08-08 06:32:41 +00:00
f0b3293dad need to go back to spawning for python 2.4 compatibilitiy 2007-08-08 06:14:04 +00:00
6c168a3e56 removing the init in common made it stop working, so readding 2007-08-08 03:36:51 +00:00
df744c4658 ident 2007-08-08 03:33:08 +00:00
e039de8406 indent fix 2007-08-08 03:31:04 +00:00
9f1efa8802 more gobject tweaks 2007-08-08 03:21:43 +00:00
658282d09d remove no longer used spawn files 2007-08-08 03:16:52 +00:00
2e1e6901da remove spawning 2007-08-08 03:15:23 +00:00
17f71c916e remove old, unused code 2007-08-08 02:30:09 +00:00
a1c252dbbe Made more buttons to use clicked signal. 2007-08-08 02:03:28 +00:00
ce513e5725 asio sync 2007-08-08 01:29:13 +00:00
174ff4ee70 fix button pressed issue 2007-08-08 01:21:39 +00:00
fc5b6e525a add print for set_[up|down]load_rate_limit 2007-08-08 01:11:59 +00:00
58d4c6381e Tweaks to move_storage. 2007-08-08 01:10:28 +00:00
ff4dad534f Locally patch libtorrent so it doesn't change files timestamps on each restart
of seeding torrents. See ticket #105 in libtorrent's trac for more details.
2007-08-07 23:53:45 +00:00
71e3e6ea32 Minor tweaks to right-click handler in torrents and files lists. 2007-08-07 19:06:39 +00:00
72a55d4523 Peers plugin tweaks. 2007-08-07 17:04:56 +00:00
5b40a50efb DRY in send info routines. 2007-08-07 14:43:02 +00:00
9f13c7e522 rename variable to be consistent with name in other files 2007-08-07 12:34:12 +00:00
b5d8aedb2b more os.path.join changes 2007-08-07 11:52:21 +00:00
0ae3bdf839 use proper os.join.path 2007-08-07 11:20:07 +00:00
0159c18da4 fix indent oops 2007-08-07 10:50:11 +00:00
9cb20a96ce only resend info if it's been over a week 2007-08-07 10:45:02 +00:00
666a043275 post 0.5.4 updates 2007-08-07 10:11:42 +00:00
63ef550e45 finally catch gnome logoff and quit properly 2007-08-07 10:02:59 +00:00
ee6087579b bah 2007-08-07 09:15:01 +00:00
67a66ce2bd sync instead of just pickle on torrent move 2007-08-07 09:08:49 +00:00
c9a15f9b64 freebsd fix retry 2007-08-07 08:47:55 +00:00
ae8def9320 fix storage oops 2007-08-07 08:43:28 +00:00
680826e969 upnp fixes 2007-08-07 08:07:19 +00:00
c06b63b027 libtorrent sync 1436 2007-08-07 07:39:08 +00:00
9dd7f6c6cf piece fix -micah 2007-08-07 06:58:34 +00:00
1897faf395 rely on server to handle duplicate entires so we can get new info when user upgrades their pygtk version, etc 2007-08-07 05:06:20 +00:00
c331e3a667 clarify what's sent 2007-08-07 04:31:09 +00:00
a520ae108e remove debug print 2007-08-07 04:26:33 +00:00
bff7ba63c7 include pygtk version 2007-08-07 04:24:44 +00:00
2c45b379fc Pieces plugin updates from eternalswd, thanks. 2007-08-07 03:17:30 +00:00
48bdbbb060 add send info pref so we can get a better idea of our users 2007-08-07 03:09:18 +00:00
bacdec3e76 remove already imported import 2007-08-07 02:54:17 +00:00
a5d5cb7f4b one for max ratio queuing and one for torrent pieces - micah 2007-08-06 23:17:21 +00:00
5c0a649a65 make freebsd exception 2007-08-06 23:05:42 +00:00
7d14b8e38f add SIGINT to signals 2007-08-06 07:04:10 +00:00
92dfa72d43 touchup last 2007-08-06 06:55:18 +00:00
48d1f51f65 save state on pause/resume/move storage 2007-08-06 06:53:45 +00:00
b8a8beaedc catch and exit cleanly on SIGTERM and SIGHUP 2007-08-06 06:23:03 +00:00
e33f9dc844 Pieces plugin fixes from eternalswd, thanks. 2007-08-06 05:59:44 +00:00
ec1c5cf2c7 Tweaks to the Peers plugin. 2007-08-06 04:37:11 +00:00
cdf3011c81 Tweaks to Peers and Files tabs plugins to handle removal of torrents. Patch is
from eternalswd, thanks.
2007-08-06 04:02:42 +00:00
9d17d21804 PEP-8 and some clean up in the Peers tab plugin. 2007-08-06 03:52:16 +00:00
3848b7c67e * PEP-8 and some clean up in the Files tab plugin.
* Some improvements to tab switching code in the interface.
2007-08-06 03:23:32 +00:00
5a0bddba31 fix last 2007-08-06 03:22:50 +00:00
0dad17b5cd add ufs/ufs2 sparse file support 2007-08-06 03:18:31 +00:00
900ac29d4c More clean ups in interface code. 2007-08-06 02:23:08 +00:00
b26ebe6883 Minor tweak to previous commit. 2007-08-06 02:15:29 +00:00
39e9e77ec6 Properly update the Files tab when multiple torrents selected. 2007-08-06 02:14:18 +00:00
faf5fe5e44 Returned instant update of the Peers and Files tabs when user clicks on
torrent. Needs testing.
2007-08-06 01:53:59 +00:00
3210066d6b And one more unused import in interface. 2007-08-06 01:16:02 +00:00
e0ceccf82c Removed unused import from interface code. 2007-08-06 01:13:57 +00:00
a430705f59 Minor changes in interface's update(). 2007-08-06 01:01:22 +00:00
0a59338936 Removed some stale code in interface's update(). 2007-08-06 00:56:27 +00:00
2463828170 my bad. add peer_pref glade 2007-08-06 00:48:14 +00:00
c77327c41f flags, dialogs remain on top, peer tab touchups - micah 2007-08-06 00:40:18 +00:00
a5411fbcd9 simple rss move and touchups 2007-08-05 22:32:11 +00:00
a4b3a53c38 Added 0.5.4 date in ChangeLog. 2007-08-05 21:45:03 +00:00
ef1296cc36 dialogs/windows modality fix 2007-08-05 20:13:24 +00:00
9024c5b620 tag 0.5.4 release 2007-08-05 16:37:47 +00:00
a0c79eb073 oops, had one thing in here twice 2007-08-05 11:32:28 +00:00
9ac1cb4240 po sync with launchpad 2007-08-05 11:06:09 +00:00
c6481f8da5 add O2 flag 2007-08-05 09:52:50 +00:00
1a3a630f4e version number for rc2 2007-08-05 09:44:56 +00:00
2ae55f556d more translation tweaks 2007-08-05 09:34:13 +00:00
8fd8509e5b translation updates 2007-08-05 09:22:08 +00:00
ea9068e3f8 fix interactive add 2007-08-05 07:40:52 +00:00
4783f31deb allow plugin to specify output path 2007-08-05 06:22:46 +00:00
b34219bd9c delete plugin.py for network graph 2007-08-05 05:44:00 +00:00
4201cb4bae network graph fix 2007-08-05 05:40:04 +00:00
38ba6e1ecf add peer blocked alert - micah 2007-08-05 05:09:03 +00:00
af48ec78e6 add location plugin to changelog 2007-08-05 04:44:32 +00:00
171e686ae5 make plugin list scrollable 2007-08-05 04:17:18 +00:00
eff70a1c2c files tab and peers tab made into plugins - micah 2007-08-05 04:07:17 +00:00
bf695f9cfa show post 0.5.4rc1 updates 2007-08-05 02:10:33 +00:00
05d3d3fd28 add locations plugin - stoffe 2007-08-05 01:06:59 +00:00
589a2cf549 Patch libtorrent locally to properly query country service with reversed IPs. 2007-08-04 23:55:27 +00:00
a92f61a48d Added peers countries to ChangeLog. 2007-08-04 20:32:13 +00:00
94d1883a3a Minor changes to peer's country flag code. 2007-08-04 20:24:02 +00:00
9571cfd96a Fixed #198 - Added countries display to peers in the Peers tab. 2007-08-04 20:12:31 +00:00
05a96dcc52 glade fix 2007-08-04 20:05:22 +00:00
c0b8f7fb5b version numbers 2007-08-04 20:04:46 +00:00
88e626a92c Add separator to Edit menu. 2007-08-04 19:58:17 +00:00
f1ae5e6156 separator in edit menu 2007-08-04 19:57:09 +00:00
06a9592a3d Properly set private flag in files selection dialog. 2007-08-04 18:47:56 +00:00
508ad6f8b2 Made names and interfaces consistent in code of all tabs. 2007-08-04 18:38:29 +00:00
92e2bd8087 Refactored peers tab code to tab_peers.py. 2007-08-04 18:17:21 +00:00
71afa115d1 Fixed #356 - Added no. of files to Torrent info in the details pane. 2007-08-04 17:27:37 +00:00
842b54523b Properly count active torrents in the queue and correctly do queueing. 2007-08-04 15:55:45 +00:00
e40398652c Properly stop DHT in torrent_stop_DHT() in deluge_core.cpp. 2007-08-04 15:29:55 +00:00
9ac7eed49b turnicate - micah 2007-08-04 08:35:31 +00:00
09558b82e4 improve pieces performance - micah 2007-08-04 07:41:27 +00:00
c0beb51d37 -mt fix 2007-08-04 07:31:40 +00:00
ea1f96c246 replace tabs with spaces 2007-08-03 22:22:40 +00:00
ffc513763f compile arg touchup 2007-08-03 22:20:08 +00:00
ba3ccb7635 break stuff up - micah 2007-08-03 21:23:12 +00:00
43ae5566ee random port speedup 2007-08-03 21:16:03 +00:00
fdae0dad68 2007-08-03 20:29:55 +00:00
4c5a51266e clean up build args 2007-08-03 20:27:09 +00:00
053dec6e9e libtorrent sync 1429 2007-08-03 18:05:17 +00:00
0585d0930e pieces tab update - micah 2007-08-03 17:59:32 +00:00
ba53e0268f Optimized counting number of DHT peers. 2007-08-03 09:06:29 +00:00
a69be4161b libtorrent sync 1427 2007-08-03 08:25:15 +00:00
b1b9f45789 fix a segfault 2007-08-03 07:41:26 +00:00
f9f1b95a4e get dht back working for now 2007-08-03 06:20:36 +00:00
396a245d84 revert last 2007-08-03 06:17:07 +00:00
86c735401d new pieces per file thing - micah 2007-08-03 05:57:37 +00:00
452ee4089c enforce queue on resume all and update changelog 2007-08-03 04:37:47 +00:00
a37bccbf68 oops, move resume all above pause all 2007-08-03 04:33:34 +00:00
1f12f3b421 add pause all and resume all to tray 2007-08-03 04:31:07 +00:00
12fe0930b3 Tweaks to random ports code. 2007-08-03 04:23:02 +00:00
6d8864338f remove clear finished from tray 2007-08-03 04:10:52 +00:00
c43224b038 changelog update 2007-08-03 04:05:25 +00:00
e10a27bf56 add session totals to tray msg 2007-08-03 03:56:09 +00:00
867687e724 Fixed #474 - Properly show unlock tray dialog when tray clicked several times
in a row.
2007-08-03 03:01:54 +00:00
aa3d1e7569 finally fix logging - micah 2007-08-02 23:47:43 +00:00
6ef4323969 eventlogging fix, hopefully - micah 2007-08-02 22:47:43 +00:00
5e7f442c8b touchup torrent menu 2007-08-02 21:46:00 +00:00
2b291340e8 prepare log tab before initializing event handling - micah 2007-08-02 19:39:16 +00:00
9579e82a7c move select all to edit menu 2007-08-02 19:35:51 +00:00
4ef33f7449 forgot a line 2007-08-02 18:47:25 +00:00
d7379227ab damn peer block 2007-08-02 18:44:27 +00:00
b7b31804c1 add peer_blocked_alert 2007-08-02 18:31:46 +00:00
b40d54cd10 separate add rule and set filter to speed things up 2007-08-02 18:20:24 +00:00
7fed084bda install prefix touchup 2007-08-02 17:52:35 +00:00
8f18530113 actually commit ip filter 2007-08-02 17:37:56 +00:00
a383f42957 set correct paths 2007-08-02 07:12:33 +00:00
5bfc868aad adds log to file - micah 2007-08-01 21:47:05 +00:00
874128f595 fix quotes...again 2007-08-01 21:33:53 +00:00
d0bc1e018a fix quotes 2007-08-01 21:31:31 +00:00
da7c5f9ff6 forgot to add proxy update 2007-08-01 21:25:46 +00:00
5d9c3b25ed add post 0.5.3 items to changelog 2007-08-01 21:18:31 +00:00
8f679e8bbc clarification of svn/unstable 2007-08-01 21:14:11 +00:00
be362d194c set default max torrents to 8 2007-08-01 20:44:40 +00:00
413c72d0aa libtorrent sync 1423 2007-08-01 20:19:54 +00:00
fbe3bc976d redone proxy support 2007-08-01 19:57:32 +00:00
8c9b1de33b dont update pieces tab with multiple or none torrents selected - micah 2007-08-01 19:27:42 +00:00
8cc8ffe4a4 2007-08-01 18:44:49 +00:00
076e04b642 change max num of connections to match utrorent's default of 200 2007-08-01 08:23:27 +00:00
ef234039f6 fix last commit's oops 2007-08-01 06:53:42 +00:00
692b0b507d event loggin plugin and libtorrent cleanup 2007-08-01 06:53:11 +00:00
908430aae4 fix libtorrent crash 2007-08-01 06:40:15 +00:00
ff18a44c8d libtorrent sync 1419 2007-08-01 05:36:25 +00:00
bb5231bdf7 touchup to new version check 2007-08-01 04:20:44 +00:00
756dcd294b add new "automatically check for new deluge version" feature :-D 2007-08-01 04:14:58 +00:00
865c826b60 fix test active port...who the hell removed this before? 2007-08-01 01:00:10 +00:00
d7d0877d8b rearrange import for pygtk assert problem 2007-08-01 00:22:42 +00:00
5aec3526cf touchups for torrentpieces - micah 2007-07-31 21:54:11 +00:00
b6ee1d0e37 torrent piece plugin - micah 2007-07-31 06:04:40 +00:00
d1342efc67 centos5 support 2007-07-30 17:21:37 +00:00
3105453e69 add upgrade info 2007-07-30 17:19:32 +00:00
a79b420eee 2007-07-30 09:35:21 +00:00
74cb012fa3 fix keyboard links 2007-07-30 09:34:33 +00:00
e31e2d7e25 fix unload bug 2007-07-30 09:31:51 +00:00
0a41a421b1 add per-torrent speed limits 2007-07-30 09:27:22 +00:00
9d32724a8e change speed submenus to specify global 2007-07-30 06:26:40 +00:00
8ef7a26c7b add 48x48 icon and have torrentnotification use it 2007-07-30 03:47:59 +00:00
25f69c52e0 add keyboard links 2007-07-30 01:58:35 +00:00
b9831e2e48 add select all torrents to torrent_menu 2007-07-30 01:34:30 +00:00
e62942c0b4 fix if/then loop 2007-07-30 00:01:57 +00:00
4f389246e2 add deluge icon to libnotify message 2007-07-29 03:27:44 +00:00
7dc82a5983 remove remnants of old pause/start 2007-07-29 03:03:47 +00:00
c6a1b06884 set tooltip for random port 2007-07-29 01:37:50 +00:00
35fdac60a6 change version number to differentiate from stable release 2007-07-28 23:13:06 +00:00
0c86a8e3ad smart prefs for random port 2007-07-28 23:02:15 +00:00
639cc297d2 account for the entire range of ports that the user has in preferences 2007-07-28 21:57:44 +00:00
83d45c4626 cosmetic touchup 2007-07-28 21:14:32 +00:00
98c6ab7137 fix dht problem with new random ports 2007-07-28 21:13:31 +00:00
a1534878c7 fix major oops 2007-07-28 20:12:22 +00:00
267ba8f7ac add use random port option 2007-07-28 18:58:59 +00:00
d77afef3c3 template update 2007-07-28 17:05:29 +00:00
1a09bf38dd lang update -onceme 2007-07-28 16:36:27 +00:00
e6085713fa have clear be insensitive if no torrents are present 2007-07-27 23:24:07 +00:00
29da6c9645 small tweak to resume 2007-07-27 23:17:31 +00:00
b25b15a902 get rid of silly up/down sensitive or not 2007-07-27 23:08:09 +00:00
eaafe81a07 separate buttons for resume/pause 2007-07-27 23:02:42 +00:00
371b18d855 connection queue fix 2007-07-27 20:12:50 +00:00
f80f499135 Tweak to [1169]. 2007-07-27 10:46:44 +00:00
7791d293a1 Tried to fix queue order issue. 2007-07-27 10:43:18 +00:00
ba675a89b3 I18N tweaks. 2007-07-27 09:20:27 +00:00
e46c75ecff fix translations in core.py 2007-07-27 08:31:46 +00:00
240d3de894 2007-07-27 08:17:30 +00:00
4d6ccb75d0 fix progress text translations 2007-07-27 07:17:06 +00:00
edb46be1b7 fix progress text translations 2007-07-27 07:15:26 +00:00
ed6b2ad3cf libtorrent sync 1417 2007-07-27 06:45:15 +00:00
b0677d937b add toolbar items to translations 2007-07-26 22:08:53 +00:00
3aea3280b8 Changed max_number_uploads preference to 10 by default after some
tests/discussion.
2007-07-26 18:11:44 +00:00
87821dfc92 * Removed unused max_number_downloads preference.
* Changed max_number_uploads from -1 to 5 by default, with unlimited number of
upload slots users have download speed issues.
2007-07-26 17:59:57 +00:00
4f23af98da Try to properly handle utf-8 and latin-1 encoded client names in the peers tab. 2007-07-26 17:35:32 +00:00
7219c84c78 Properly focus preferences dialog of the RSS plugin. 2007-07-26 17:20:03 +00:00
1258eafd9e lang update 2007-07-26 06:29:59 +00:00
cb370be039 tag 0.5.3 release 2007-07-25 23:33:22 +00:00
7e861f6848 launchpad lang sync 2007-07-25 22:40:14 +00:00
10f6fd64ff Use screen depth resolution in NetworkGraph plugin. 2007-07-25 11:53:46 +00:00
38923ed22b remove scheduler plugin from translation 2007-07-25 07:49:25 +00:00
dfc0c962cf remove scheduler for stable 0.5.3 release 2007-07-25 02:14:07 +00:00
e4c37ffab8 Set correct tooltip for Max Global Upload Slots option. 2007-07-24 23:07:17 +00:00
150a1a8a46 Show files selection dialog even for single file torrents. 2007-07-24 22:50:03 +00:00
09c430f05a 2007-07-24 21:16:05 +00:00
2953c7606d version number 2007-07-24 21:13:11 +00:00
43af92d2ed remove files.py from translation and add new tab files 2007-07-24 21:02:19 +00:00
7b4009d6cf remove redundant upload slot 2007-07-24 20:59:47 +00:00
d812cb6729 blah 2007-07-24 20:55:20 +00:00
a5082fda82 float/int tweaks 2007-07-24 20:30:34 +00:00
98f38f3e71 fix max_number_uploads name in core 2007-07-24 20:24:01 +00:00
31128a2e25 fix max_number_uploads name 2007-07-24 20:21:23 +00:00
585f9b20b6 add max upload slots per torrent preference 2007-07-24 20:05:58 +00:00
bf1b157b88 Tweaks to the files tab code. 2007-07-24 20:00:35 +00:00
47e723fa89 Moved the files tab code to tab_files.py. 2007-07-24 19:57:37 +00:00
49b39e638d Tweaks to the details tab code. 2007-07-24 19:52:21 +00:00
9fac711ff7 Properly update the Details tab of paused torrents. 2007-07-24 19:43:28 +00:00
2e035967d0 remove extra border 2007-07-24 19:34:19 +00:00
a8795e8de9 remove redundant border in the torrent-info tab -Mattias Bengtsson 2007-07-24 19:20:18 +00:00
f539c8e9e8 libtorrent sync 1416 2007-07-24 19:11:59 +00:00
63c573aaa5 fix for opening urls if not installed to /usr 2007-07-24 17:21:38 +00:00
52635dfa59 tooltip on RSS button 2007-07-24 17:14:05 +00:00
ae2f7d60c9 update README to use Makefile to build and install deluge 2007-07-24 17:05:31 +00:00
f8e1df3515 scrollable text area in plugins dlg 2007-07-24 16:59:20 +00:00
117cbb7d1b 2007-07-24 16:34:49 +00:00
a4c44252f3 Tweak Makefile to allow user specified prefixes 2007-07-24 16:31:17 +00:00
d277cfb21a auto-detect python version for uninstall and change xpm to png 2007-07-24 11:07:53 +00:00
ef293f0742 Remove some debug prints from RSS plugin 2007-07-24 05:44:49 +00:00
603675494d __file__ change for foresightlinux people 2007-07-24 05:10:33 +00:00
02cd556f18 remove firstlast plugin from POTFILES, rearrange preferences, change version number for rc2, sync translation with launchpad 2007-07-24 02:12:04 +00:00
ae649c7c3b Tweaks to first/last pieces priorities code. 2007-07-24 00:23:50 +00:00
f0149c4474 Added first and last pieces priorities to ChangeLog. 2007-07-24 00:08:03 +00:00
0bc90356a7 set default to false as to be nice to the protocol 2007-07-23 23:31:52 +00:00
442cac8aef Fixed #368 - Added ability to prioritize first and last pieces of files in
torrent.
2007-07-23 23:29:37 +00:00
f5bed290df remove flexrss since it's broken 2007-07-23 23:01:26 +00:00
ddfc5ef95d add utf8 encoding to files 2007-07-23 21:59:32 +00:00
507f8a4139 add spawning to deal with 2.5 being stupid with threading 2007-07-23 21:52:13 +00:00
1a05d470a2 fix version number assert error 2007-07-23 21:21:36 +00:00
5bcf5fbfac flexrss update by 'daddy' 2007-07-23 20:52:25 +00:00
bf46b310a5 set version number for 0.5.3 release 2007-07-23 20:48:03 +00:00
77e5b62fac 2007-07-23 18:56:37 +00:00
98f21aca86 Tweaks to [1102]. Get compact_mode for the Files tab with
manager.get_torrent_state(), for the Files selection dialog with preferences.
2007-07-23 14:24:38 +00:00
87e2b36074 remove translation from stock lables 2007-07-23 08:18:36 +00:00
48eb4504ec dont translate close and ok 2007-07-23 07:27:18 +00:00
8aedf2d201 add compact_mode check to changelog 2007-07-23 07:16:24 +00:00
cb0b5c3e1c get compact_mode per torrent_state, not prefs 2007-07-23 06:28:37 +00:00
903a8da7a5 add compact_mode to torrent_status in deluge_core 2007-07-23 05:36:01 +00:00
a0fb5a12fa libtorrent 1415 sync 2007-07-23 05:31:17 +00:00
b220064462 disable lsd for private torrents 2007-07-23 01:17:33 +00:00
946a86c815 Fixes an issue with clear_max_ratio_torrents and changes pause/resume block in
Manager.apply_queue() to use enumerate. Patch is from eternalswd, thanks.
2007-07-22 22:48:59 +00:00
3ec15816ac Refactored the way we update any gtk.ListStore instance and made the Peers tab
use less CPU.
2007-07-22 19:17:50 +00:00
6c78b6595f Clean ups to torrents list and files tab focus code. 2007-07-22 17:35:39 +00:00
67976167aa Made focus in the Files tab to work the same way as in torrents list. 2007-07-22 17:17:30 +00:00
2c746a3ee9 fix right click on file tab not selecting the row 2007-07-22 07:44:43 +00:00
b57b07b783 RSS plugin by 'daddy' 2007-07-22 06:16:17 +00:00
369c21b6f7 fix gay resizing of alignment 2...only 5 should expand when resizing window 2007-07-22 06:07:42 +00:00
1bf9ccdfc2 Don't update paused torrents in UI. Based on the idea by eternalswd. 2007-07-22 05:05:52 +00:00
d3613a8ce6 Set the torrent view to resize. 2007-07-22 01:00:28 +00:00
95b03bdb48 i18n for status bar. never finished with i18n, it seems :) 2007-07-21 22:37:07 +00:00
d9c2ab0a32 Minor changes. 2007-07-21 21:41:24 +00:00
2fb2cdda10 Added Don't repeat yourself (DRY) principle to recommendations in HACKING. 2007-07-21 21:40:01 +00:00
12a685dff1 with ntfs-3g and reiser4 support, considering the new priority feature, set default to full alloc 2007-07-21 21:06:09 +00:00
a6f22ccc09 show alert and stop action when trying to change priorities with compact allocation 2007-07-21 21:04:10 +00:00
b6c99ce1c2 i18n touchup for blocklist plugin 2007-07-21 20:17:20 +00:00
4ec3a75538 Added availability and piece size to ChangeLog. 2007-07-21 19:33:54 +00:00
7738f8c290 Added availability column. 2007-07-21 19:28:30 +00:00
04b5a8936e move pieces and avail to left side so right side isnt so much higher 2007-07-21 19:05:44 +00:00
4f266454ec Some tweaks to availability and piece size display. 2007-07-21 18:59:01 +00:00
7a37c58dde Properly calculate ETA in common.estimate_eta(). 2007-07-21 18:53:31 +00:00
92acd7907e Fixed #331 - Added availability and piece size to Torrent Info pane. 2007-07-21 18:08:32 +00:00
3bba92929d same again 2007-07-21 07:42:10 +00:00
380fcf889a fix last 2007-07-21 07:32:11 +00:00
b73ce6fb46 general updates on plugin - lazka 2007-07-21 07:15:18 +00:00
619e418a16 Added one forced UI update when restoring from minimized state. 2007-07-20 23:27:03 +00:00
34e268defd Forced update of UI when main window is restored from tray or from minimized
state.
2007-07-20 23:15:36 +00:00
b3a912cdea Fixed some issues in [1067]. Thanks for testing, eternalswd. 2007-07-20 23:11:03 +00:00
3f13587ed9 Optimized cached_data() class and all depended functions and their usage.
Needs testing.
2007-07-20 22:41:26 +00:00
6876c4b67c add all plugin files to our template 2007-07-20 22:09:54 +00:00
48b0b106f5 make blocklist plugin translatable 2007-07-20 22:08:48 +00:00
8182b5ce9a made rss plugin translatable 2007-07-20 21:25:48 +00:00
8a39796daa make torrentnotification plugin translatable 2007-07-20 21:17:34 +00:00
88b356f22b make networkhealth plugin translatable 2007-07-20 21:14:11 +00:00
6df2dba77d make networkgraph plugin translatable 2007-07-20 21:12:11 +00:00
396e3501ff missed two strings in search plugin that needed translating 2007-07-20 21:09:37 +00:00
df5b85cd40 make scheduler plugin translatable 2007-07-20 21:07:55 +00:00
7ef61be07c add i18n to torrent search plugin 2007-07-20 21:01:51 +00:00
4b253ff9e8 fix non urgency oops 2007-07-20 20:17:00 +00:00
6049f72a93 fix typo 2007-07-20 20:06:24 +00:00
a21ae0e9c0 Minor tweaks to interface code. 2007-07-20 19:20:10 +00:00
3bac6bcfc8 Properly do i18n in common.fsize(). 2007-07-20 19:03:15 +00:00
a6e8db9bb0 Fixes one typo that was causing an error in handle_events and adds attribute self.update_interface to DelugeGTK class so that plugins can determine whether or not to update information for the interface - micah 2007-07-20 18:36:16 +00:00
938c1fed43 Some performance tweaks. Still the main issue is in Tree View to display data
and more tweaks to come.
2007-07-20 11:58:55 +00:00
76184c1be8 Added merging trackers of duplicate torrents to ChangeLog. 2007-07-20 08:17:28 +00:00
5cd99eace3 remove debug print 2007-07-20 07:53:29 +00:00
09334d8892 update gui tweaks - micah 2007-07-20 07:42:35 +00:00
e80da672f0 Clean up output 2007-07-20 05:43:12 +00:00
e7ddc59322 add merge_dialog to translation 2007-07-20 02:37:33 +00:00
e0311a9ff3 duplicate torrent trackers merge - micah 2007-07-20 02:32:33 +00:00
1f6d182f76 Added event for each tracker alert we are intrested in and some tracker
status messages i18n tweaks.
2007-07-19 21:14:30 +00:00
31407d0231 ghetto i18n support for tracker messages 2007-07-19 20:08:45 +00:00
7787a6cf0c Added more informative tracker status display. 2007-07-19 19:33:49 +00:00
f486ea3dc1 Removed Manager.set_pref() function as it's not used anywhere. 2007-07-19 16:27:34 +00:00
c0de2bd32d Minor clean ups in the core. 2007-07-19 15:48:02 +00:00
1c5db57f79 TorrentNotification plugin updates. Thanks, eternalswd. 2007-07-19 04:42:51 +00:00
4e8fe33658 Add torrent in interactive_add_torrent() only if we succefully passed all
checks.
2007-07-18 19:18:59 +00:00
8f96d9318a Some fine tune tweaks to [1004]. 2007-07-18 19:12:29 +00:00
d15442493c Some more recommendations in HACKING. 2007-07-18 18:56:50 +00:00
173e5743e7 update translations for 0.5.3rc1 2007-07-18 14:45:27 +00:00
858269986a add alex dedul to authors list 2007-07-18 14:42:19 +00:00
ff8c02b8ce Attempt to handle the issue with fast resume. Thanks, eternalswd. 2007-07-18 14:19:39 +00:00
d209d8d7ed Added files priorities to ChangeLog. 2007-07-18 14:07:04 +00:00
a7ce81d4d0 Some queue above completed feature touch ups. Thanks, eternalswd. 2007-07-18 13:06:22 +00:00
280f4dfb10 Added files priorities. 2007-07-18 12:47:24 +00:00
9310c7dce5 Minor clean up in the files manager. 2007-07-18 10:00:41 +00:00
76bf286a52 Open urls in browser from UI without threading for now until we find out why
it causes up to 1 minute delays.
2007-07-18 09:46:27 +00:00
6a22d12975 * Added dump_torrent_info_file() to core to just list files in torrent by its
filename.
* Replaced all file filters in torrents with priorities. Nothing to see in UI
yet. Based on patch from eternalswd.
2007-07-18 09:06:24 +00:00
89972e1e54 fix gay toolbar spacing 2007-07-18 04:52:02 +00:00
a3acf0aed9 Some more smart preferences tweaks. Thanks, eternalswd. 2007-07-18 03:41:26 +00:00
0cbb9b49cf Spacing tweaks. Previous commit [1024] is based on patch from eternalswd, thanks. 2007-07-18 03:11:36 +00:00
c42b54d6c4 Tweaks for smart preferences. 2007-07-18 03:08:06 +00:00
94bdc619fc fix for smart dlg 2007-07-17 22:35:16 +00:00
7a93e1a0fd preliminary smart pref dialog 2007-07-17 22:29:53 +00:00
ce535213b0 change rss image 2007-07-17 20:52:10 +00:00
e8eab5909d show plugins toolbar buttons 2007-07-17 20:48:14 +00:00
b914af3403 toolbar button for scheduler 2007-07-17 20:40:50 +00:00
f04a29bb03 better menu icon 2007-07-17 20:05:20 +00:00
c5e7c0d7bd Fixed typo in manager.set_priv(). 2007-07-17 17:16:44 +00:00
0016c39656 Removed unused code from interface.build_torrent_table(). 2007-07-17 15:22:50 +00:00
37825effa1 minor bugfixes - mark adamson 2007-07-17 12:23:32 +00:00
6f7ceb4faa keyboard shortcut 2007-07-17 11:32:38 +00:00
0297409f2f additional move_storage conditional -micah 2007-07-17 09:15:43 +00:00
d04124b998 fix disk_io move_storage 2007-07-17 09:00:04 +00:00
2ef85f46db revert 1010 2007-07-17 08:31:34 +00:00
7eef1a418e fix move_storage behavior 2007-07-17 08:15:55 +00:00
b5673d563e fix uploads limit 2007-07-17 07:02:56 +00:00
93921971ed new max ratio features -micah 2007-07-17 06:00:33 +00:00
6793741972 fix to append when there are no torrents - micah 2007-07-17 05:52:09 +00:00
d9b1fce480 option to load new torrents above completed ones 2007-07-17 05:24:43 +00:00
d94c7e6986 last commit fix 2007-07-17 05:03:31 +00:00
776004320e clear on max ratio - micah 2007-07-17 04:51:11 +00:00
e9a42b6fcd lt 1405 sync 2007-07-17 02:24:34 +00:00
a055299141 remove autotools stuff that obviously arent happening in 0.5.x trunk 2007-07-17 00:57:32 +00:00
ad869e1460 remove autotools stuff that obviously arent happening in 0.5.x trunk 2007-07-17 00:57:29 +00:00
571fe44987 remove autotools stuff that obviously arent happening in 0.5.x trunk 2007-07-17 00:56:26 +00:00
da4081b8b6 Set '.torrent' extension by default when creating torrent. 2007-07-16 23:17:53 +00:00
9fcf4eb4c0 Hm, ULONG doesn't work as expected - reverted back to UINT64. 2007-07-16 23:13:54 +00:00
27cf24a679 Changed all gobject.TYPE_UINT64 to gobject.TYPE_ULONG - it's more
future-compatible this way.
2007-07-16 22:46:32 +00:00
26b74f442a readme touchup 2007-07-16 21:00:42 +00:00
95a4b770cd Some love for #209 - Added Macedonian translation of Deluge. 2007-07-16 20:13:15 +00:00
89cedf7565 Changed wording in ChangeLog. 2007-07-16 19:07:27 +00:00
df898e22b8 Fixed #268 - Tweaks for torrents loading from command line, from url. 2007-07-16 16:07:06 +00:00
30b69cd85a open_url_in_browser() tweaks. 2007-07-16 15:26:37 +00:00
681e43ef9d Properly focus preferences dialog of TorrentNotification plugin. 2007-07-16 14:55:53 +00:00
3e528b0966 Properly center files selection dialog. 2007-07-16 14:15:50 +00:00
6d42f2234e Plugins and preferences dialogs code clean up. 2007-07-16 13:59:22 +00:00
468667d068 Cleaned up files selection dialog code. 2007-07-16 13:31:30 +00:00
ea239ee6ef Show files selection dialog only if torrent contains 2 and more files. 2007-07-16 12:12:51 +00:00
2e489bb00b Tweaks to TorrentNotification plugin. 2007-07-16 12:05:24 +00:00
3115498790 Tweaks to plugins events. 2007-07-16 11:51:12 +00:00
ac81d240bd Massive clean up of loading torrents. 2007-07-16 03:23:36 +00:00
c0cb16425b add tooltip to help new users with private flag 2007-07-16 01:49:11 +00:00
1d09e5009f remove unneeded deluge.in 2007-07-16 01:46:09 +00:00
877aa31fc3 priv flag 2007-07-16 00:21:17 +00:00
afa8f88292 connect set_priv in file selection dialog 2007-07-16 00:15:04 +00:00
cec8cef864 changelog update with ticket numbers -micah 2007-07-15 23:52:57 +00:00
e9ded6f25f set private flag when adding torrents with the file selection thingy - not yet connected 2007-07-15 23:48:12 +00:00
83bf3d76db back to total_wanted - micah catch 2007-07-15 22:27:26 +00:00
c1271ffbc1 add files.py to be translated 2007-07-15 21:23:16 +00:00
31c028f54e changelog updates 2007-07-15 21:19:09 +00:00
c93a5c57b7 Added feature select files when adding torrent. Patch is from eternalswd,
thanks :).
2007-07-15 19:24:37 +00:00
b06922dcd4 libtorrent sync 1401 2007-07-15 19:06:12 +00:00
e95c399ac5 rss plugin 2007-07-15 19:00:52 +00:00
db32e74895 RSS plugin by Mark Adamson with some gui tweaks from me 2007-07-15 18:49:45 +00:00
ede8627b77 Added core.prioritize_files(). 2007-07-15 16:53:54 +00:00
76c82d8946 Set default values of preferences "default_finished_path" and
"default_download_path" to user's $HOME/.
2007-07-15 12:43:21 +00:00
6e1a1b88fa fix last piece oops 2007-07-15 09:22:39 +00:00
e84d6cf588 adding First/Last piece priority plugin 2007-07-15 09:20:45 +00:00
23f744cada fix small torrent issue 2007-07-15 08:06:06 +00:00
ae0d21f115 set other as an option and not requirement for radio menus and changed label in glade file to be set by the plugin itself - fixes other in desired ratio plugin from saying 'Speed' 2007-07-15 07:04:38 +00:00
5a103a4e35 Fixed ETA display issue when it doesn't fit to python's int and become long. 2007-07-15 06:51:03 +00:00
9d68f5f494 Minor wording change in ChangeLog. 2007-07-15 04:29:25 +00:00
82b54e809f backlog for posterity 2007-07-15 04:15:34 +00:00
8d69ed21de Minor changes. 2007-07-15 04:13:20 +00:00
5f3e065073 Added ChangeLog. 2007-07-15 04:06:31 +00:00
4dab371209 remove empty column - no visible change 2007-07-15 02:56:18 +00:00
ff0ff0364a Show text from clipboard in Add URL dialog only if it looks like an URL. 2007-07-15 02:36:09 +00:00
baf18969f6 translation touchup 2007-07-15 02:30:03 +00:00
99a6b4bcc7 translation touchup 2007-07-15 02:18:30 +00:00
44880135d9 translation fixes 2007-07-15 02:03:27 +00:00
0ba0fb9407 PEP8 imports in interface.py. 2007-07-15 01:42:53 +00:00
3fa2ebd11c Minor changes. 2007-07-15 01:19:40 +00:00
e9c618f506 Minor changes. 2007-07-15 01:17:59 +00:00
0999349be5 Fixed #437 - Startup no longer fails with old persistent.state files. Thanks,
codergeek42.
2007-07-15 00:55:53 +00:00
f31b079a42 didnt mean to uncomment print events, so i'm commenting it again 2007-07-14 22:29:53 +00:00
78d8d116cc more cleaning up - removing unneeded white spaces 2007-07-14 22:22:37 +00:00
70b6e40a55 mostly code layout cleanup 2007-07-14 21:52:22 +00:00
375d73431c fix #420 - total size to total wanted along with eta update - micah 2007-07-14 20:58:46 +00:00
4964f11943 Fixed Clear Completed feature. 2007-07-14 10:58:29 +00:00
01edae6a7b Fixed Plugins dialog to properly set_sensitive() for Preferences button. 2007-07-14 08:58:30 +00:00
14b0ec2e96 Fixed up EVENT_FINISHED event in core.handle_events(self). 2007-07-14 08:24:54 +00:00
76c8792ce4 Cleaned up core.handle_events(self). 2007-07-14 08:04:52 +00:00
8ba55e4dfa Replaced TrayBlink plugin with TorrentNotification plugin. Patch from
eternalswd.
2007-07-14 01:38:31 +00:00
b123ffbc34 minor touchup 2007-07-13 20:57:25 +00:00
c0d86f9a66 fix the nightmare that is move_storage with gui alert 2007-07-13 20:53:38 +00:00
ee7137a196 expose storage move failure - micah 2007-07-13 20:18:24 +00:00
9e80e91ae9 expose storage_moved_alert 2007-07-13 19:50:17 +00:00
8dad5d9fd8 Bringed back self.notebook in DelugeGTK(was removed in [931]) as it is used by
plugins.
NetworkGraph plugin is working again.
2007-07-13 17:05:44 +00:00
105703d630 removing old, useless plugins 2007-07-13 16:50:25 +00:00
62bb4cd961 Tried to fix move completed feature. 2007-07-13 08:25:28 +00:00
28133d0e07 Show plugins list sorted by name by default in Plugins dialog. 2007-07-13 07:53:16 +00:00
a60470b58b Fixed forced UI update when user changes tabs. 2007-07-13 07:36:36 +00:00
e081888a9e trayblink plugin - micah 2007-07-13 06:09:18 +00:00
ad8e685743 breaks off browser calls so the client doesnt hang 2007-07-13 05:41:59 +00:00
27d5db228a Pass events to plugins in a more resource aware way. Based on andar's
proposition.
2007-07-13 05:14:29 +00:00
a0ca8a031e Minor fix. 2007-07-13 04:33:31 +00:00
cbbce338f9 Renamed plugin's event handling method to 'handle_events'. 2007-07-13 04:31:54 +00:00
1eed8f34d9 Spacing fixed. 2007-07-13 04:26:38 +00:00
6705e87160 open up events to plugins - elpargo 2007-07-13 03:40:31 +00:00
90ac623215 Fixed #421, #430 - check/uncheck files on the Files tab should be working
correct now.
2007-07-13 02:18:52 +00:00
63d19d05bc mostly pep8 fixes 2007-07-13 01:13:13 +00:00
77b5ce765b version fix 2007-07-13 00:47:27 +00:00
aaa856b931 forgot a file, oops 2007-07-13 00:15:19 +00:00
ce59598635 set program version so we dont get people using svn and saying it's 0.5.2 or 0.5.3 2007-07-13 00:13:40 +00:00
2fe15d8198 More tweaks to the Peers and Files tabs. 2007-07-12 23:03:07 +00:00
358e9384bd gui tweak and version number 2007-07-12 21:10:46 +00:00
6f0d751067 Reduce CPU usage on Files tab even more. 2007-07-12 20:35:49 +00:00
ef8e1185ed Indent fixes. 2007-07-12 19:50:34 +00:00
4c03881aba raise gui warning on move_storage failure 2007-07-12 19:38:47 +00:00
e09d489077 Remove some obscure var and associated parts of code from UI. 2007-07-12 19:01:46 +00:00
86db5dbaa7 Refactor Statusbar and Tray Tips update. 2007-07-12 18:38:54 +00:00
9f8385eda5 Clean up loading of plugins. 2007-07-12 17:56:37 +00:00
dedef184c4 Add comment about usage of self.statusbar_temp_msg in DelugeGTK.update() and
minor fix.
2007-07-12 17:27:34 +00:00
680c30e0de Minor update UI code clean up. 2007-07-12 16:02:42 +00:00
b5aff38295 Massive clean up in UI update code. Update torrents info UI instantly when we
click on them in torrents list.
2007-07-12 10:21:03 +00:00
d07e8cddb6 More Files tab clean up. 2007-07-12 05:41:27 +00:00
a4000c46e2 Test commit, fixed spacing. 2007-07-12 02:30:55 +00:00
1cdea54047 fix cpu usage in peer and file tab - plisk 2007-07-11 21:17:39 +00:00
7938cb7fba only change storage dir location if move is successful 2007-07-11 20:59:33 +00:00
cd70b85850 fixes seeding issue after restarting deluge when move_storage is enabled - micah 2007-07-11 20:48:49 +00:00
3f9193592f do not code at 4:30am 2007-07-11 09:29:21 +00:00
ecb552f939 touchup for file progress 2007-07-11 09:26:03 +00:00
2d9948e083 fix peers tab oops 2007-07-11 09:16:33 +00:00
db11bd01eb fix missing pref 2007-07-11 09:08:21 +00:00
73bde09e49 fix file progress hang...yes\! 2007-07-11 09:02:13 +00:00
ee856c7521 fix last commit 2007-07-11 08:13:06 +00:00
1e1c5ed780 move finished downloads to - eternalswd 2007-07-11 08:04:45 +00:00
c5e2b67800 clean up torrent list creation - plisk 2007-07-11 07:26:07 +00:00
37a502ad40 more file progress tweaks but not enough 2007-07-11 07:08:06 +00:00
8faf6d624a cleanup file tab progress code 2007-07-11 06:55:27 +00:00
623c1c8dfc Fix sorting by size on the Files tab - plisk 2007-07-11 05:30:49 +00:00
8ecd826e8a coding style guidelines 2007-07-11 05:00:10 +00:00
2efe45896b fix buildvalue segfault 2007-07-11 04:34:15 +00:00
2482aba77b remove offset in file tab - plisk 2007-07-11 04:29:07 +00:00
d27137b4e2 fixing imports and indents to comply with python style guide - first attempt, this might break things 2007-07-11 04:22:44 +00:00
6fd53ec356 fix typo 2007-07-11 02:31:44 +00:00
432adbab87 make up/dl speed usage consistent - plisk 2007-07-11 02:25:19 +00:00
9dfbe53ed6 add 'help translate this app' to help menu 2007-07-11 00:43:16 +00:00
cbf1c5c9ab remove unused torrent_popup 2007-07-10 22:40:52 +00:00
33d3ecc5cd 1395 lt sync 2007-07-10 20:09:44 +00:00
bdf37286cf #422 -plisk 2007-07-10 19:56:25 +00:00
6aabd140f5 ntfs-3g - plisk 2007-07-10 19:52:02 +00:00
3c3703bdf1 reiser4 support in libtorrent - plisk 2007-07-09 23:20:36 +00:00
3e04e54937 1392 lt snc 2007-07-09 18:56:38 +00:00
788b882f0f ydl 5.0 support 2007-07-09 18:47:32 +00:00
db50da4fc0 optimized peer_connection by postponing diffie hellman key creation and generation of handhake until the connection has succeeded 2007-07-09 06:17:52 +00:00
3e53b24db7 cleanup - eternalswd/plisk 2007-07-09 05:38:05 +00:00
11eecbc293 remember dir of last loaded torrent - eternalswd 2007-07-09 04:40:34 +00:00
51eb0040e3 get rid of additions and rely on extra compile flag 2007-07-09 03:26:11 +00:00
8ee99ee9a1 Allow 'deluge_core.cpp' to be compiled without NDEBUG defined. Patch
from plisk.
2007-07-09 02:26:59 +00:00
c87d165a1f lt sync 1388 2007-07-08 21:06:45 +00:00
6f7ac72599 start hidden in tray fix - oksana 2007-07-08 20:55:31 +00:00
ac483482b6 tray toggle preferences - plisk 2007-07-08 20:54:31 +00:00
210329f85b fix typo 2007-07-08 01:38:10 +00:00
3a699585d5 fix exception for preferences 2007-07-08 01:37:39 +00:00
d122e57f1a stfu 2007-07-08 01:11:54 +00:00
6bfd1d504d more info to help newbies 2007-07-08 00:50:47 +00:00
7d3c05f3fa lt sync 1384 2007-07-07 20:54:26 +00:00
2eed5c615c openssl cleanup 2007-07-07 00:13:37 +00:00
9d8e27754c change default from float to int to prevent warning 2007-07-07 00:11:56 +00:00
9be38a0ad0 peer_connections stats fix 2007-07-06 20:52:47 +00:00
8f520c717b made the piece picker handle multi-request blocks better. fixes problem that might occur at the end of a torrent where the piece picker could take over blocks back and forth 2007-07-06 18:11:01 +00:00
334d7ec341 shorten toolbar labels 2007-07-06 18:02:37 +00:00
38deb031b7 blag 60001 support 2007-07-06 11:31:45 +00:00
642e62b793 lt sync 1378 2007-07-06 10:07:36 +00:00
238289049d change some default prefs 2007-07-06 03:46:43 +00:00
57bf0f35f9 fix prefix and add 2.4 2007-07-06 03:28:31 +00:00
606bd6bcf1 add andar 2007-07-06 02:42:15 +00:00
f9bfd9c6cb made piece picker less anal about speed categories, to improve performance 2007-07-06 01:44:16 +00:00
83c9b2f275 0.5.2 release 2007-07-06 01:10:37 +00:00
180c77b3f7 remove unnecessary update 2007-07-06 01:09:08 +00:00
0f7708bcc6 change dir 2007-07-06 00:59:36 +00:00
b3c32803de initial import and conversion to new plugin format 2007-07-06 00:57:33 +00:00
f18ee4e1e8 2007-07-06 00:06:28 +00:00
b77fcdf6ef shortened things up 2007-07-06 00:03:12 +00:00
fc8791deba little touchup and uninstall 2007-07-05 23:50:05 +00:00
2c958c6cf5 fix typo 2007-07-05 21:56:35 +00:00
5cc4865e8a default compact allocation 2007-07-05 20:09:27 +00:00
da539f5353 Add '-NDEBUG' to EXTRA_COMPILE_ARGS for some systems that don't seem to
add it properly to CFLAGS.  Seems to effect python-2.5 systems.
2007-07-04 21:46:41 +00:00
e618d37611 Remove bogus assert() 2007-07-04 21:31:12 +00:00
daaf215f64 i18n updates 2007-07-04 19:18:21 +00:00
4ea66b684f activates or deactivates the queue-up/down arrows depending on which torrents are selected. It also makes it possible to move several torrents at the same time - Mattias Bengtsson 2007-07-04 08:48:20 +00:00
bdf9182bb5 DesiredRatio plugin will now reset all desired ratios in the core upon
unload().
2007-07-03 21:17:07 +00:00
e2eab3f2c0 show tooltips on labels as well 2007-07-03 02:15:15 +00:00
43c19d0d0b fix tooltip for max active torrents 2007-07-03 02:03:13 +00:00
bee4a3c552 lets us not need to alter hasher.hpp to compile 2007-07-03 01:14:18 +00:00
0a78631a6c remove bandwidth_manager.cpp 2007-07-03 00:13:49 +00:00
31f84d1c24 libtrunk sync 1370 2007-07-03 00:12:14 +00:00
b6b9fb4276 libtrunk sync 1369 2007-07-02 20:34:46 +00:00
20755b32c5 2007-07-01 03:30:46 +00:00
3c4eb6201e fix bug of dht starting before a listening port is set 2007-07-01 03:18:54 +00:00
728107f3a8 libtorrent svn 'pi->pe_support == false' assertion 2007-06-30 08:11:47 +00:00
aec942d243 2007-06-30 07:08:20 +00:00
1a5500703b french/lang updates - rpmfarm 2007-06-29 07:30:49 +00:00
2f1cfd8546 Fix download/upload tray menu speed list 2007-06-29 05:09:37 +00:00
159aef9680 fix typo 2007-06-29 02:03:48 +00:00
afd563d7b7 multiple file add 2007-06-29 02:00:15 +00:00
f3d83f687d win remove quote 2007-06-28 23:08:20 +00:00
72d6a0ebd5 win touchups 2007-06-28 23:00:36 +00:00
cd1de4388c Fix double values in desired ratio list 2007-06-28 18:45:34 +00:00
7c81ee68f1 fix typo 2007-06-28 14:44:58 +00:00
3edeea1e25 win deps again 2007-06-28 14:42:49 +00:00
b35b08d9f7 set more windows-specific paths 2007-06-28 14:14:09 +00:00
7b92e05326 set boost path for windows 2007-06-28 13:22:51 +00:00
6f03bef238 more windows stupidity 2007-06-28 13:20:17 +00:00
c681ad5299 windows is retarded. needs this '_' to compile 2007-06-28 12:59:40 +00:00
9ff9a38049 Force an update() when changing notebook tabs 2007-06-28 08:22:41 +00:00
9e5e6ddfb9 Fix remove torrent lock-up issue. 2007-06-28 08:16:12 +00:00
fa2814b498 Added a couple more forced update()'s to improve UI responsiveness 2007-06-28 07:40:15 +00:00
aa6b522036 blocklist doesn't config every load 2007-06-28 00:51:14 +00:00
b0e047368c just a template update 2007-06-27 23:54:40 +00:00
0cd1ebb009 Fixes for translations. #383, #384 rpmfarm@free.fr
Did not include the fr.po patch because I believe it is out-of-date.
2007-06-27 22:59:45 +00:00
6658d64db0 add vertical scrollbar 2007-06-27 22:33:16 +00:00
297b8ce65a do search on enter 2007-06-27 22:31:09 +00:00
b375ede4d0 fix remove torrent bug 2007-06-27 21:20:37 +00:00
c566ff7231 synch po files with launchpad 2007-06-27 20:32:37 +00:00
f2a38204d7 Call update() prior to setting the timer 2007-06-27 20:02:17 +00:00
9ac9f13044 Remove old desired ratio code 2007-06-27 19:55:35 +00:00
d64a5c0d03 Initial import of DesiredRatio plugin.
Removed desired ratio options from tray menu, but code from old method 
still exists in interface.py.
2007-06-27 19:51:31 +00:00
b0e1210c1b Some updates to build_menu_radio_list for use with the DesiredRatio
plugin.
2007-06-27 19:37:05 +00:00
7aff2c1ae9 remove max_number_torrents 2007-06-27 19:35:12 +00:00
8d0c348598 Fixed so preferences is saving to 'max_active_torrents' and not the
invalid 'max_number_torrents'
2007-06-27 19:31:00 +00:00
aec3bd392b sync remove torrent loop fix - aaron 2007-06-27 18:15:37 +00:00
a2c63a1f49 prepping for rc1 2007-06-27 15:42:10 +00:00
b036e5abe1 status col expand again 2007-06-27 15:40:11 +00:00
30fced111e Change tray menu item order 2007-06-27 05:54:44 +00:00
30700a67c7 Add mnemonic to New Torrent menu item. 2007-06-27 05:45:18 +00:00
999a4d31c7 Add tooltip to New Torrent tool button 2007-06-26 22:56:43 +00:00
2a646d91c0 fix exception in handle_events 2007-06-26 20:12:47 +00:00
433e6aa28d fix queue_bottom in handle_event 2007-06-26 19:56:23 +00:00
3779a025ff Fix write resume data on seed
Fix apply_queue in update
2007-06-26 18:56:58 +00:00
a2a18d35d8 remove buggy fast resume on seed 2007-06-26 18:54:25 +00:00
d5a2d53b96 you're right, my bad 2007-06-26 18:47:09 +00:00
b1c923c1f3 handle_events already calls apply_queue, so there's no need to do it right before 2007-06-26 18:43:12 +00:00
f4d542b568 Have update() call handle_events() 2007-06-26 18:39:54 +00:00
92e985cec0 Updated status icons 2007-06-26 18:16:02 +00:00
eeafe64e0f set icon size to 1 in torrent right-click menu 2007-06-26 08:59:51 +00:00
f6e8f6d13e save fast resume once torrent finshes so as to not recheck seed if client crashes 2007-06-26 08:53:48 +00:00
63cc644195 Make torrent view columns reorderable. 2007-06-26 07:44:20 +00:00
ea315a3720 Stop the status column from expanding. 2007-06-26 07:42:37 +00:00
44d649036b Changed the min_width of the torrent view columns so they can be shrunk
smaller than previously able to.
2007-06-26 07:30:53 +00:00
1383e6c3ca Change status icon sizes from 22 pixels to 16 pixels. 2007-06-26 07:16:53 +00:00
7372e8b26b Change icon sizes in tray menu 2007-06-26 07:00:03 +00:00
4fb4fb32f7 Changed the show/hide window option in the tray menu to a CheckMenuItem
and have it toggle accordingly.
2007-06-26 06:15:00 +00:00
c5fc69fa2e update version info and plugin details 2007-06-26 05:58:52 +00:00
1f4665c189 add multiple file selection for 'add torrent' 2007-06-26 05:51:45 +00:00
8649b4b973 remembers configuration in the UI and fixes a cancellation bug - tarka 2007-06-26 04:31:55 +00:00
3091a6943f fix my typo 2007-06-26 04:29:19 +00:00
5d1f64b537 'python pygtk' was redundant 2007-06-26 04:23:06 +00:00
263ac80e6a added tooltips for newbies 2007-06-26 04:18:36 +00:00
5f657fdd7a we want efficient torrents, so added capability for smaller piece sizes 2007-06-26 03:56:47 +00:00
1a91ff7c5c Some minor UI updates for TorrentCreator 2007-06-26 03:24:00 +00:00
85d1078dd2 also add python-dbus to dependency list 2007-06-26 02:43:52 +00:00
547d378ceb remove unneeded includes and cleanup 2007-06-26 02:07:17 +00:00
11ae69c83d set severity level to info 2007-06-26 01:19:31 +00:00
304b4156ab TorrentCreator is now interfaced with the core and is able to create
torrents.
2007-06-26 01:17:15 +00:00
efe63cb722 fix last commit 2007-06-25 23:37:44 +00:00
936a0fceab add a small count of blocks in the status bar - tarka 2007-06-25 23:31:26 +00:00
826057649c Some updates to the torrentcreator interface. 2007-06-25 23:11:16 +00:00
0407c8119a remove wacky progress slider - increases speed by literally hundreds of times 2007-06-25 21:35:39 +00:00
7a760d16a5 add runtime dependencies for newbies 2007-06-25 16:58:25 +00:00
3490a99f7b add more keyboard links 2007-06-25 16:37:25 +00:00
b99341ed7a Remove 'Create Torrent' option from File menu. 2007-06-25 10:00:23 +00:00
b5ca613cd5 New TorrentCreator plugin. It is not interfaced to core yet and as such
is non-functional.
2007-06-25 09:58:32 +00:00
a74d64080f blocklist update -tarka 2007-06-25 07:53:58 +00:00
b22a0111ca Fix up edit trackers 2007-06-25 03:56:51 +00:00
367f5823d2 remove blank lines from edit tracker list 2007-06-25 03:17:07 +00:00
6601a0a7e3 edit tracker done 2007-06-25 02:25:53 +00:00
66e61a62bc edit trackers fixing 2007-06-25 02:20:23 +00:00
b1d14357a1 trying to cleanup replace tracker code 2007-06-25 00:52:19 +00:00
2aaf9277c8 fix add url bug 2007-06-24 22:33:32 +00:00
2c4978b9ef active ok button in edit trackers list 2007-06-24 22:24:21 +00:00
078af4148f fix blocklist indents 2007-06-24 18:55:47 +00:00
c97fafa2b3 fix indented block error 2007-06-24 17:11:41 +00:00
08cd36de7f test updates for blocklist - tarka 2007-06-24 10:32:51 +00:00
61f000fae9 add underline shortcuts 2007-06-24 06:01:59 +00:00
1ec8c9bdc5 mule list support for blocklist - tarka 2007-06-24 05:45:01 +00:00
7484ff5bb0 remove unused old code 2007-06-24 05:27:50 +00:00
27ab96fa94 remove unneeded edit tracker debug line 2007-06-24 05:26:34 +00:00
be5a7f5767 edit tracker glade touchup 2007-06-24 05:24:48 +00:00
50d7282fcb beginnings of gui interface for editing trackers 2007-06-24 05:14:00 +00:00
bc76d648ba remove unused code 2007-06-23 19:34:49 +00:00
51d0f95d0d go back to latin-1...weird errors with utf-8 2007-06-22 23:59:35 +00:00
38d8b20072 switch to using utf-8 instead of latin-1 2007-06-22 23:48:27 +00:00
27c55eb8c7 make ratio in torrent view be 4 digits instead of 3, to match summary details pane 2007-06-22 22:46:19 +00:00
7c65bce6d8 fix negative ratio bug. maybe :) 2007-06-22 22:31:53 +00:00
2bb0ec122e fix default value of max num of torrents 2007-06-22 18:24:41 +00:00
3374b5f50c Do not start DHT Proxy if DHT is not started 2007-06-22 09:20:44 +00:00
93a0945915 Prevent set_DHT() from starting DHT if it's already started. 2007-06-22 09:10:32 +00:00
47aa99eb6d Change the code for the tray download/upload speed limiting to be more
generalized thus removing duplicated code.
2007-06-22 08:15:52 +00:00
94dc14b355 Only call apply_prefs() if OK is pressed in the Preferences dialog. 2007-06-22 07:21:46 +00:00
ee9e5a09ea . 2007-06-22 03:21:44 +00:00
bad3ea64d2 remove web seed proxy 2007-06-22 03:21:19 +00:00
c98ca19dbe tooltip touchups 2007-06-22 01:09:38 +00:00
b75a3c3dda cast max torrents to float 2007-06-21 23:36:36 +00:00
4682fe3079 add max_number_torrents default 2007-06-21 23:32:03 +00:00
554baccc4a Fix segfault in torrent_proxy_settings()
The torrent name column is resizable again
2007-06-21 23:27:42 +00:00
34fe76780e Add missing semi-colons 2007-06-21 23:13:37 +00:00
67c09ebf56 deluge_core update for proxy 2007-06-21 23:12:36 +00:00
0b34410f37 same 2007-06-21 23:06:20 +00:00
fcbc3b48b4 new proxy redone 2007-06-21 23:06:06 +00:00
65f1f32771 Changed Preferences.get() to not set a type or default value.
If a default value is needed, it should be set in the DEFAULT_PREFS 
dictionary in pref.py.
2007-06-21 22:38:48 +00:00
7024caa6f3 Fix deprecation warning 2007-06-21 22:19:18 +00:00
80335eb0ae lt updates 2007-06-21 21:42:32 +00:00
92263af970 upped default number of max connections to match that of utorrent 2007-06-21 19:16:05 +00:00
34809aa74d fix for last commit. oops 2007-06-21 19:10:08 +00:00
3603445992 unlimited max connections show as unlimited in status bar, not -1 2007-06-21 18:56:15 +00:00
3ef9e9a3c6 bringing infinity back (timberlake style) 2007-06-21 18:52:18 +00:00
c642991d9f grey out icons if no torrent is selected ticket #360 - benmat 2007-06-21 18:27:20 +00:00
41c4669149 fix download rate setting 2007-06-21 16:10:48 +00:00
85d3c16c6d reactive remove torrent in toolbar. oops 2007-06-21 08:32:05 +00:00
77fca5a1c0 automatically paste clipboard contents on 'add url' 2007-06-21 07:49:15 +00:00
b5fa8939e4 bitfield may be sent after interested 2007-06-21 06:24:02 +00:00
862d59f8cc remove 'remove torrent' from file menu 2007-06-21 01:01:53 +00:00
820d427a61 Small fix for list order in tray upload speed limit submenu 2007-06-21 00:50:43 +00:00
652639540f Add 'max_connections' to status bar and tray tooltip 2007-06-21 00:48:35 +00:00
a132c6a038 Add 'max_upload_rate' and 'max_download_rate' to tray tooltip.
Will now display 'Unlimited' if the max is -1
2007-06-21 00:45:34 +00:00
8454c4b416 Add 'max_download_rate' and 'max_upload_rate' to the status bar. 2007-06-21 00:41:39 +00:00
28b3ad4a80 fix missing comma 2007-06-21 00:29:22 +00:00
a17466f6b9 Changed status icons size.
Changed the way the download/upload speed limit is done in the system 
tray.
2007-06-20 23:34:53 +00:00
3e2332ecd3 Fix 'auto_end_seeding' preference to actually be used by apply_queue()
Fixed some text in the Download/Upload speed system tray menu
2007-06-20 19:42:37 +00:00
b5ac3b880b didnt mean to update setup.py...reverting that part. 2007-06-20 19:20:46 +00:00
8a3c47eea2 add "remove torrent" to right-click menu 2007-06-20 19:19:59 +00:00
846058a8d0 resync with lt trunk 2007-06-20 19:11:44 +00:00
620aab25f9 glade file for tray menu - idefixx 2007-06-20 19:08:49 +00:00
0023e44ed1 guess i was wrong 2007-06-20 07:56:26 +00:00
a3236a275e fix stop seeding ratio 2007-06-20 07:41:23 +00:00
82660a29cc change eta from infinity to done for seeding files 2007-06-20 07:35:44 +00:00
e166b066dd upload/download limit setting in tray - idefix 2007-06-20 02:07:38 +00:00
05bf525ff9 Fix 'queue_seeds_to_bottom' to actually work. 2007-06-19 23:44:21 +00:00
c557dcd293 Fix 'max_active_torrents' spinner to allow for -1 value. 2007-06-19 23:40:00 +00:00
221304325a Fixes for auto end seed ratio.
Torrents will now pause and queue to bottom when ratio is hit.
2007-06-19 23:37:23 +00:00
7be4e7f9b7 Use 'max_active_torrents' instead of 'max_number_torrents'
Adjust default for 'max_connections' to 200
2007-06-19 21:21:52 +00:00
7635b91bb4 remove line 2007-06-19 21:11:10 +00:00
973f80e6f9 Fixed GtkWarning and made the details pane scrollable 2007-06-19 18:44:51 +00:00
06758b2b86 fix auto seed ratio stuff 2007-06-19 08:51:21 +00:00
e6a1d2ab9f -1 clarification 2007-06-19 08:39:27 +00:00
72752fbbfe Better looking colours 2007-06-19 07:50:25 +00:00
5843ddf4d3 Resume fix 2007-06-19 06:16:50 +00:00
f59155bd48 Add status icons to the torrent view 2007-06-19 05:41:03 +00:00
449b9bd972 Some changes to the torrent view column setup.. Using an enumerated type
(sort of) instead of just numbers.
2007-06-19 05:16:19 +00:00
e2e1828454 fix enable system tray pref 2007-06-19 03:19:02 +00:00
b885d2deeb Do not check for available free space if resuming a torrent that is
seeding
2007-06-19 03:17:23 +00:00
3118c2912f More pause/resume fix ups 2007-06-19 03:13:29 +00:00
9ec33795a9 revert 664...i'll make the menu a glade file soon 2007-06-19 00:59:09 +00:00
af928cf83f switch hide show in systray 2007-06-19 00:20:26 +00:00
29bbac19db fix type and log pad size when using encryption 2007-06-18 20:25:54 +00:00
829294cc80 oops, one more file 2007-06-17 21:51:03 +00:00
708f85296f fix max connections 2007-06-17 21:49:46 +00:00
1a9a714fe7 tidy up 2007-06-17 17:12:22 +00:00
6ea7ddd7a0 fixed mutex issue in disk io thread 2007-06-17 14:21:44 +00:00
fa0a4813a6 for blocklist, fixes cancelling downloads and not being able to update broken configurations - tarka/steve 2007-06-17 14:02:17 +00:00
1d6984b0ba adds basic text blocklist support - tarka/steve 2007-06-17 04:59:24 +00:00
82d2fb08c0 remove undeeded code 2007-06-17 03:26:12 +00:00
f8cb36a109 Fix window position when restoring window from tray 2007-06-17 02:38:56 +00:00
20c4323cc7 allocation fix 2007-06-17 01:13:46 +00:00
ce150491c0 align proxy prefs 2007-06-16 23:08:44 +00:00
8eb04467bb Small fix for the resume code 2007-06-16 18:56:11 +00:00
73e7e741dd proper prefix fix 2007-06-16 14:57:46 +00:00
a7b9c89557 remove debug print 2007-06-16 12:30:35 +00:00
1cd18512dc proxy touchup 2007-06-16 12:26:43 +00:00
6da1ec0ad1 remove frame 2007-06-16 11:36:30 +00:00
71ed6b6f67 proxy support 2007-06-16 10:56:09 +00:00
8873ac3cce clarification touchup 2007-06-16 07:02:40 +00:00
39e7d25c1e add "desired ratio" option on per torrent basis 2007-06-16 07:00:55 +00:00
df63d91a46 default "remove .torrent" checked 2007-06-16 06:04:53 +00:00
525526316c connect queue to top 2007-06-16 05:45:22 +00:00
ac99ef7d26 remove unused code 2007-06-16 04:47:35 +00:00
726992ab53 Some minor fix ups for the pause/resume 2007-06-16 02:16:34 +00:00
eede17988a Fixed up Pausing/Resuming in the interface, especially the Torrent menu.
Forcing update() on pausing/resuming and queue changes to improve UI 
responsiveness.
2007-06-16 02:09:03 +00:00
57d5ae802f remove debug printouts 2007-06-15 23:23:17 +00:00
ec03ff3085 Remove 'applying queue' print out 2007-06-15 23:14:58 +00:00
261be67769 add new lt files 2007-06-15 22:30:39 +00:00
72261756f5 restart need notice on utpex 2007-06-15 21:54:43 +00:00
1d4561d513 remove debug print line 2007-06-15 21:53:34 +00:00
630f55dda2 add two new lt files 2007-06-15 21:46:39 +00:00
55e5b75e54 major lt upgrade to trunk and turn on options for upnp, natpmp and utpex 2007-06-15 21:45:53 +00:00
cdf34e92e9 Have the torrent view sort by Queue order by default. 2007-06-15 08:48:40 +00:00
8390e3977e embarrassing bug fixed in queue_bottom, that caused torrents to vanish... 2007-06-15 08:41:32 +00:00
2982ae4b8c Update() now calls manager.apply_queue()
Small fix in get_selected_torrent() to account for a TypeError
2007-06-15 08:31:45 +00:00
2be048d89e prevent infinite recursion in apply_queue 2007-06-15 08:20:52 +00:00
cb4358f65e apply_queue after all queuing operations 2007-06-15 08:14:02 +00:00
d195907bde Changed the check for available space. Libtorrent automatically pauses
torrents if there is not enough disk space available.  There is now an 
available disk space check when the user tries to resume a torrent.
2007-06-15 07:35:04 +00:00
1b6205990f Testing 2007-06-14 23:35:55 +00:00
2538406872 Testing 2007-06-14 23:32:13 +00:00
edd017b785 Some of my updates to the UI. Re-added the scrolled window to the
details pane, but glade doesn't seem to load it properly.  Added word 
wrapping for a few of the fields.  Also added Torrent to the menubar and 
it uses the torrent_menu from the right-click pop-up menu.
2007-06-14 22:03:04 +00:00
cac850939c remove homog setting for now 2007-06-14 21:50:37 +00:00
1cb3439b06 v 2007-06-14 21:10:22 +00:00
3dce6a919d Set 'Resize' on the top vpane so that the lower vpane will not resize
when the window size is changed.
2007-06-14 20:51:08 +00:00
e9beaa35b1 my name was misspelled, wtf? 2007-06-14 20:49:02 +00:00
2468275ef8 version # 2007-06-14 20:46:05 +00:00
dad6a5e956 ui tweaking 2007-06-14 20:38:49 +00:00
f631fb3116 Delete torrent's files correctly now. 2007-06-14 20:01:22 +00:00
797ac38ca7 Delete torrent's files correctly now. 2007-06-14 19:59:48 +00:00
7cbb69bd20 more ui stuff 2007-06-14 19:01:17 +00:00
eefdb466e6 gui tweaking 2007-06-14 17:35:19 +00:00
477278961b remove dht limit pref 2007-06-14 15:59:02 +00:00
bcefc45880 these seeds/peers numbers appears to be working better. 2007-06-14 13:49:57 +00:00
d4f241ce5f fix seeds/peers numbers with help of libtorrent author so i know it's finally right 2007-06-14 12:45:00 +00:00
31d21bb161 remove dir even if it has empty dirs left over 2007-06-14 05:34:59 +00:00
c598637824 Update authors list 2007-06-14 01:22:03 +00:00
63a8ddb39e ubuntu 6.10 support 2007-06-13 21:56:48 +00:00
29f5f732f6 ok...real fix for torrentsearch :) 2007-06-13 21:42:20 +00:00
525a6091eb fix torrentsearch - nuno 2007-06-13 21:29:36 +00:00
3d1e4017d3 Now able to specify if the .torrent file gets deleted when removing a
torrent.
2007-06-13 21:10:12 +00:00
ed76e66e3d Updated the Remove Torrent alert. 2007-06-13 20:56:05 +00:00
6e1f089fc8 fix for not sorting correctly in file tab if sort column was not progress column 2007-06-13 19:23:33 +00:00
856764489a Fix tracker display issue 2007-06-13 18:42:21 +00:00
d17ec86483 fix networkgraph plugin for new module system 2007-06-13 17:13:30 +00:00
04cd6fb67b libtorrent 'endpoint not connected' exception fix 2007-06-13 16:21:59 +00:00
188af2eee3 fix oops 2007-06-13 07:48:50 +00:00
9a588c73f9 fix default for auto_seed_ratio 2007-06-13 07:47:58 +00:00
393cbafa19 actually save/load auto_end_seeding and auto_seed_ratio settings 2007-06-13 07:41:16 +00:00
0c4f08afdf check if update is necessary first 2007-06-13 06:06:46 +00:00
f0ba87c28e fix crash 2007-06-13 05:36:51 +00:00
96cc172ae1 cleanup automatic progress update in file tab 2007-06-13 04:20:05 +00:00
180fb899f4 ok...progress in file tab again 2007-06-13 03:58:27 +00:00
1c5c82f3af reverse 591 2007-06-13 03:47:51 +00:00
412017ae46 reactivate progress in file tab *WITH* automatic updating of percentages per file 2007-06-13 03:35:48 +00:00
67073ba8c5 Fix problem with removing torrent. 2007-06-13 01:33:16 +00:00
43ea807a9b Reverted the preferences state saving because it was silly.
Did some touch-ups on the Preferences dialog.
2007-06-12 23:23:05 +00:00
56d61f1570 The preferences dialog state (height, width, x, y) is now saved. 2007-06-12 22:45:30 +00:00
2c2f646a47 Fix for the Details pane to not have a fixed height. 2007-06-12 21:54:47 +00:00
da127646cd Better fix for the toolbar text issue. This one does not override the
user's system preferences.
2007-06-12 21:17:12 +00:00
2df62aef08 Fix for toolbar not displaying text. 2007-06-12 21:08:18 +00:00
cc2c6d94d4 more autotools work 2007-06-12 20:35:59 +00:00
e0e502aaa9 Update interface.py for use with the new Details pane. 2007-06-12 20:09:44 +00:00
0f075deadd Updates to the main UI including a complete re-design of the Details
pane.
2007-06-12 20:07:06 +00:00
df31a83f0b readme touchup 2007-06-12 19:41:17 +00:00
ac749997c5 fedora 7 support 2007-06-12 19:14:19 +00:00
70c8b4de9a ui tinkering 2007-06-12 17:51:33 +00:00
caa0f1427a beginnings of automake files 2007-06-12 17:44:05 +00:00
fab729a5c6 svg logo 2007-06-12 16:37:58 +00:00
442bdf1c4c license fixes 2007-06-12 16:33:32 +00:00
20f2696bad plugins reworked as modules and ip block - tarka 2007-06-12 08:13:16 +00:00
c7fa12bc81 Fix to the window pane settings 2007-06-12 05:06:13 +00:00
f4cda9baaf The window vpane position is now saved.
Re-ordered default preferences to be alphabetical.
2007-06-12 03:42:40 +00:00
3b9b8beba1 revert ip block and module changes 2007-06-12 03:32:49 +00:00
5414b2eb12 revert ip block and module changes 2007-06-12 03:32:39 +00:00
976df3963f add 2007-06-12 03:01:48 +00:00
4fe3d2769d new plugin system + ip block plugin...hopefully... 2007-06-12 02:52:53 +00:00
0d2711ab06 This should fix the window displaying before it is ready. 2007-06-12 02:52:18 +00:00
71a25a4c9c i'm an idiot 2007-06-12 02:27:29 +00:00
127e85c565 fix interface.start 2007-06-12 02:21:18 +00:00
352861703c Better window geometry handling.
Window geometry will now save maximize state.
Main window is now hidden until it has been resized/moved.
2007-06-12 02:16:30 +00:00
7fbd166725 missing bracklet 2007-06-12 02:09:36 +00:00
ee579a5e6d missed one line last commit 2007-06-12 02:03:32 +00:00
0c774012d8 remove progress lines from interfaces.py since it's already out of glade file 2007-06-12 01:56:46 +00:00
1d4b1eea2b -- 2007-06-11 23:55:56 +00:00
76e753868d tid-bit 2007-06-11 22:38:03 +00:00
45f5b0427a note for packagers 2007-06-11 22:35:20 +00:00
86c092da7d . 2007-06-11 22:21:02 +00:00
3461c96a1f revert 524 2007-06-11 22:11:03 +00:00
0072fe6c6f fix issue with changing enable_dht causing segfault
enabling and disabling DHT no longer requires a restart
2007-06-11 21:37:39 +00:00
7c5af812c5 upgrade warning in README 2007-06-11 20:12:33 +00:00
a2b4fe56e0 remove the ugly lines in the preferences dialog 2007-06-11 19:38:34 +00:00
73ee474246 remove gui update from preferences 2007-06-11 19:19:23 +00:00
0493996bc5 cleaned up apply_prefs() a bit in interface.py and removed some
unneccesary prefs
2007-06-11 19:05:14 +00:00
d689b14569 removing the other test file 2007-06-11 18:47:25 +00:00
ac72cacff5 removing test file 2007-06-11 18:46:06 +00:00
545787a69c 2007-06-11 18:45:21 +00:00
794051b298 2007-06-11 18:42:27 +00:00
29e08fff02 popup menu to the file tab with the options: select all, unselect all, check selected, uncheck selected - nuno. ticket #259 2007-06-11 18:38:06 +00:00
bc251af5e8 testing hooks 2007-06-11 18:34:37 +00:00
908863e8f4 -- 2007-06-11 18:31:26 +00:00
2df9e0ddf1 popup menu to the file tab with the options: select all, unselect all, check selected, uncheck selected - nuno. ticket #259 2007-06-11 18:28:26 +00:00
7d0aa62671 fixed the percentage complete column in the peers display 2007-06-11 08:54:17 +00:00
0b78316d65 Fixed the Total Download summary to show the correct amount. 2007-06-11 06:35:17 +00:00
fff2bd45b6 remove unused fields 2007-06-11 03:57:32 +00:00
93ff39aff2 2007-06-11 02:39:51 +00:00
5306653552 testing 2007-06-11 02:07:33 +00:00
b50236154e testing 2007-06-10 22:31:26 +00:00
432f3dcf3f testing 2007-06-10 22:23:42 +00:00
f82cb59710 removing DEFAULT_PREFS from interface.py.. it is in prefs.py 2007-06-10 21:36:44 +00:00
8392052dc2 readme touchup 2007-06-10 20:16:42 +00:00
694e837c6c multiple torrent selction - madmonk 2007-06-10 20:00:16 +00:00
2dfdb98e53 clean up output a bit 2007-06-10 08:42:19 +00:00
3b344f0ee6 this fixes the torrentsearch plugin 2007-06-10 07:57:23 +00:00
034ea9e1a8 modified pref.py so that plugins can use the class to save their
preferences.. This fixes the issue with the torrent search plugin
2007-06-10 04:34:26 +00:00
07a73f6039 proper prefix for size - ticket #178 2007-06-10 02:04:12 +00:00
72e34d4d87 selection of multiple files, and toggle them in peers tab - madmonk 2007-06-10 01:20:27 +00:00
1f6127160c fix shutil.copy() exception. ticket #308 - regulate 2007-06-10 01:03:30 +00:00
baebb214fa drag and drop support for weblinks and an error message for url-adds - lazka with some changes by markybob 2007-06-10 01:01:05 +00:00
81a5a8abd7 allow url from command line - tarka 2007-06-09 23:50:10 +00:00
e77a3318da more fixes for the peers/seeds display.. 2007-06-09 19:43:07 +00:00
9bd479160f fixed buf with torrents having peers despite being paused .. this is
from upstream svn
2007-06-09 03:38:31 +00:00
810f26395f more fixes for the seeds/peers count.. should work perfectly now
fix get_peer_info return types
2007-06-09 02:44:03 +00:00
e74e6d2bca fix to report proper seeds and peers 2007-06-09 02:05:46 +00:00
881a85be20 trying a little session close rearranging 2007-06-09 01:32:54 +00:00
687df9590c latest peer/seed try 2007-06-09 01:29:34 +00:00
be897f8ec1 peers change 2007-06-09 01:15:00 +00:00
2c6b146ae6 deps update 2007-06-08 23:02:59 +00:00
9dcbbdaadf changed the order of torrent_quit to properly shutdown the session 2007-06-08 22:25:53 +00:00
8f5a4ad319 fixed up torrent_get_torrent_state() to use proper types where
applicable
2007-06-08 22:09:00 +00:00
5a77bf4b72 total_done to double (too large for int) 2007-06-08 21:50:38 +00:00
a217199897 . 2007-06-08 21:31:11 +00:00
60f2fb44ba indent fix 2007-06-08 21:07:28 +00:00
93b533e547 mandriva 2007.1 support 2007-06-08 20:22:52 +00:00
2bd9c9cbf8 fixed saving of encryption level preference 2007-06-08 20:01:30 +00:00
8bbe6f4e13 . 2007-06-08 19:31:22 +00:00
d66b4042a7 raise limits of download speeds 2007-06-08 19:27:50 +00:00
52a5d62de2 update total upload and total download with previous totals + current session 2007-06-08 15:46:51 +00:00
cf3c3263d0 fix last 2007-06-08 15:13:17 +00:00
2a1824786b revert part of rev 502. changing total_size from int back to double (int broke large downloads, ie my 9G download was showing up as total size 890MB or so). 2007-06-08 14:30:37 +00:00
f75dd27760 fixed up display of ETA to be more consistant 2007-06-08 09:29:48 +00:00
c1d3d7ea81 have calc_ratio return 0 on exception instead of -1 2007-06-08 08:55:05 +00:00
a40b8e4d50 details stats fixes 2007-06-08 08:49:24 +00:00
2cc373e5fe add uploaded_memory back 2007-06-08 08:19:20 +00:00
3969504d24 fix number of pieces output 2007-06-08 07:16:39 +00:00
fb22b316c1 fix payload oops 2007-06-08 06:59:40 +00:00
d9d482b4df upload and download set to payload 2007-06-08 06:47:22 +00:00
626db30b49 - 2007-06-08 06:25:38 +00:00
5e1f70fbfb test port moved to deluge server 2007-06-08 05:28:57 +00:00
be4df918bd RC1 2007-06-08 04:50:19 +00:00
e54affdbaa testport in prefs 2007-06-08 03:13:34 +00:00
a074ef17ce tooltips touchupfix the problem where torrents disappear after an improper shutdown - andar 2007-06-08 01:48:12 +00:00
d4db41078b tooltips touchup 2007-06-08 01:11:04 +00:00
2406bbcbae debug removal 2007-06-08 00:51:22 +00:00
90a473e013 global preferences patch by andar 2007-06-08 00:15:51 +00:00
1b6f40c12a update depends list 2007-06-07 22:30:20 +00:00
6effa6b050 always on note for upnp/etc 2007-06-07 21:06:55 +00:00
152fe39c43 enc cleanup 2007-06-07 20:49:36 +00:00
07d15709a6 enc fix 2007-06-07 20:05:33 +00:00
5a04b7aeed enc cleanup 2007-06-07 19:21:58 +00:00
d2ca1cc97e enc cleanup 2007-06-07 19:15:47 +00:00
8d30cbd9c1 enc cleanup 2007-06-07 07:59:16 +00:00
32c2a6efa8 enc oops 2007-06-07 03:57:19 +00:00
b7602db5a4 remove upload/download from right-click 2007-06-06 23:18:16 +00:00
9f5b05b4d3 prefs, especially encryption, redone by andar 2007-06-06 22:26:52 +00:00
dfa10203bb peer flag lt fix 2007-06-06 00:15:49 +00:00
3c562d4128 typo fix 2007-06-05 18:45:38 +00:00
66e967608b lt lazy bitfield fix 2007-06-05 14:49:30 +00:00
48f6e5e1e9 report encryption data in peer_info 2007-06-05 09:08:24 +00:00
6d1805c85d Fixed bug in reporting num_seeds+num_peers > num_connections 2007-06-05 08:53:04 +00:00
e60f5382dd better clean 2007-06-05 05:48:50 +00:00
ac0cd4b98f opensuse 10.2 fix 2007-06-05 05:19:55 +00:00
4ba1a8cfb0 . 2007-06-05 03:17:46 +00:00
0155df2d58 freebsd fix oops 2007-06-05 03:16:26 +00:00
5175dbf72d freebsd setup.py support 2007-06-04 18:13:04 +00:00
20a3ddae48 2007-06-04 13:55:17 +00:00
aa66fc0360 remove debug 2007-06-03 16:59:08 +00:00
388dc1bf7f setup fix 2007-06-03 16:37:15 +00:00
8df0c184db possible lt freeze fix 2007-06-03 16:36:06 +00:00
595c16d858 libtorrent fix 2007-06-02 21:08:07 +00:00
21b9e10aed ppc fix and libtorrent updates 2007-06-02 21:05:12 +00:00
c6202e1986 ppc detection fix 2007-06-01 21:15:14 +00:00
f5e4990016 fix to remove empty directory left from a removed torrent 2007-06-01 12:09:15 +00:00
9eeaded023 oops. summary name fix 2007-06-01 10:16:10 +00:00
4c37eaade1 more percentages fixes for peer tab and files tab 2007-06-01 09:21:45 +00:00
e09ee8aef7 more percentages fixes for peer tab and files tab 2007-06-01 09:19:32 +00:00
4a65431460 fix percentages for proper ordering of columns 2007-06-01 08:42:11 +00:00
2494d05967 clear torrent title as well 2007-06-01 05:10:23 +00:00
04b97701e3 cosmetic 2007-06-01 02:14:36 +00:00
b435822191 more lt storage fixes 2007-05-31 23:47:40 +00:00
8093185a4b lt storage fix 2007-05-31 22:04:51 +00:00
5907bf254f lt fix 2007-05-31 20:20:27 +00:00
5e70f78df0 hopefully a non-problematic fix to the num-seeds and num-peers values 2007-05-31 09:12:41 +00:00
b1320232cc svn lb 1302 2007-05-31 07:20:14 +00:00
8ecf829d58 merge encryption 2007-05-31 01:29:09 +00:00
7b02217703 enc 2007-05-31 01:06:49 +00:00
ecbf6860e0 enc 2007-05-31 00:20:43 +00:00
61761160ba file allocation fix for enc branch 2007-05-31 00:10:43 +00:00
ff87f4bde5 enc stuff 2007-05-30 23:39:04 +00:00
ca9e9afcbd enc stuff 2007-05-30 23:33:58 +00:00
4f7f4cf5c4 enc stuff 2007-05-30 22:40:54 +00:00
9703881b38 fix full allocation 2007-05-30 22:27:32 +00:00
0f63808f31 rollback kripken 'fix' 2007-05-30 21:07:58 +00:00
2b93b71f7e lt sync to 1298 2007-05-30 19:43:30 +00:00
8c35be16b6 lt sync to 1298 2007-05-30 19:42:54 +00:00
8feff006d7 increase connection limits 2007-05-30 19:16:29 +00:00
1482ec4938 update proxy changes in lt trunk 2007-05-30 19:07:27 +00:00
a3b2efaa1b unneeded lines 2007-05-30 18:57:23 +00:00
e1a3f460f5 update to latest trunk fixes from kripken 2007-05-30 18:56:36 +00:00
b92a704e43 no -1's in num seeds and peers 2007-05-30 18:53:54 +00:00
798efb7183 report correct num seeds&peers, at long last 2007-05-30 18:41:15 +00:00
a75e2d40b8 enc stuff 2007-05-30 09:45:40 +00:00
0d66e0473a enc stuff 2007-05-30 09:09:41 +00:00
8938d7d21d enc stuff 2007-05-30 08:33:12 +00:00
09367b9798 enc stuff 2007-05-30 07:47:00 +00:00
33919f79c4 enc stuff 2007-05-30 07:09:55 +00:00
b5980d2dcc enc stuff 2007-05-30 06:50:43 +00:00
413e2998fa lang update 2007-05-30 04:26:09 +00:00
37478f8e72 lang update 2007-05-30 04:12:51 +00:00
6a1cf41fc4 enc stuff 2007-05-29 09:38:10 +00:00
e60c08c184 typos 2007-05-29 09:30:05 +00:00
c12e23ca95 link to openssl libs 2007-05-29 09:27:35 +00:00
49c29562f9 enc tryouts 2007-05-29 08:39:30 +00:00
5e90d29f58 fedora 6 fix 2007-05-28 09:55:17 +00:00
fdb19af20f . 2007-05-28 01:56:15 +00:00
01dfabe708 add upnp/natpmp/utpex to preferences 2007-05-28 01:51:50 +00:00
56dafeaaaf add fedora 6 to list of nomt builds 2007-05-28 01:11:33 +00:00
eb3e938b77 fix to not fail on missing torrent 2007-05-27 23:25:21 +00:00
e11c2f95e8 tagging 0.5.1 beta 1 2007-05-27 23:07:35 +00:00
02e349abc0 patch to not check EPOLL - prevents FTBFS in debian 2007-05-27 14:29:03 +00:00
1aab78442f pretty it up 2007-05-27 10:02:49 +00:00
b9742f21f7 fix compatibility changes 2007-05-27 10:02:36 +00:00
6d515c8f39 sync to lt 1293 2007-05-26 23:32:19 +00:00
8e7e46c856 pref fixes 2007-05-26 00:19:11 +00:00
35ca1e9dcd remove upnp prefs from dialogs and interfaces 2007-05-26 00:03:53 +00:00
fc7c3b142e refresh to lt rev 1290 2007-05-25 22:40:26 +00:00
0ea75cd486 removing unneeded libraries and includes 2007-05-25 21:48:33 +00:00
ec54ea9e3b removing upnp preference, as there is no way in libtorrent to not use it...so we have no choice 2007-05-25 20:39:45 +00:00
1a813cc750 reupping lt 2007-05-25 20:29:28 +00:00
1b5ce85e40 libtorrent dir seems corrupt beyond repair....just deleting and reupping 2007-05-25 20:25:48 +00:00
ac3690fdee lt 0.13 more fix 2007-05-25 20:23:37 +00:00
51f93a2bd3 lt 0.13 fix (i hope) 2007-05-25 20:11:54 +00:00
4722aa5796 here we go...lt 0.13...upnp & natpmp support! 2007-05-25 19:59:20 +00:00
3324d7afc7 . 2007-05-25 17:57:35 +00:00
a910d47f23 add make clean 2007-05-25 17:51:05 +00:00
55d64262db i've got to stop programming drunk 2007-05-25 17:26:42 +00:00
9c57852f89 passwd lock for real this time 2007-05-25 08:17:22 +00:00
6425b94d7a remove passwd lock 2007-05-25 07:31:31 +00:00
163a6ad771 passwd lock systray 2007-05-25 07:10:22 +00:00
41a9fcbeb4 removing pex preference 2007-05-24 23:55:36 +00:00
e1d1aca7a3 removing pex preference 2007-05-24 23:55:27 +00:00
bf00e75226 - 2007-05-24 17:42:13 +00:00
89c0f5ca5f distro auto-detect cleanup 2007-05-24 06:57:37 +00:00
bc3a9e5b8a check for distro type to hopefully fix '-mt' no '-mnt' for good. 2007-05-23 19:51:21 +00:00
b1c4b4d448 cosmetic touchups 2007-05-23 14:32:04 +00:00
defd700c45 activate ut_pex and metadata from swarm 2007-05-23 14:23:28 +00:00
7a5b4b388f fix for libtorrent 0.12's file_pool 2007-05-23 02:39:50 +00:00
38e241c379 upgrade to libtorrent 0.12 ...yay! 2007-05-23 02:39:03 +00:00
c9d4c59249 . 2007-05-23 00:26:03 +00:00
fe5302700b makefile 2007-05-22 22:48:51 +00:00
95fa1cbd36 fix for libboost 1.34 and remove debian-only settings which are no longer needed with this 1.34 fix. 2007-05-21 22:58:08 +00:00
198d869ed3 create torrent plugin import 2007-05-21 22:54:42 +00:00
69fbc82384 adding initial support for create torrent plugin 2007-05-21 22:53:39 +00:00
edfcf9355d updating authors 2007-05-19 00:35:05 +00:00
7b29ad7766 this should've been set with rev #376. my bad. 2007-05-18 17:41:48 +00:00
5c24f49eed deprecated now that preferences_dialog.glade is used 2007-05-18 17:35:30 +00:00
2d27ce1bd2 this fixes the second problem in ticket #193
"Start / Pause" should change when button is pressed
2007-05-18 02:38:53 +00:00
b8a58dc74c update lang files 2007-05-18 01:10:21 +00:00
4ca1ff89a0 close ticket #166 - set min-height for gtk.notebook 2007-05-17 22:52:20 +00:00
6d7004f4d9 fix import calls 2007-05-17 19:20:03 +00:00
c88d19be14 fix window focus on application load 2007-05-17 19:05:02 +00:00
db2a67c413 remove website url from glade file and put it in dialogs.py 2007-05-17 19:01:29 +00:00
b21df61126 oops - fixing accidental import mixup 2007-05-17 18:54:53 +00:00
aa37076c6d oops - fixing accidental import mixup 2007-05-17 18:54:51 +00:00
4812d09529 oops - fixing accidental import mixup 2007-05-17 18:54:49 +00:00
371759a09c oops - fixing accidental import mixup 2007-05-17 18:54:46 +00:00
4f75551d29 oops - fixing accidental import mixup 2007-05-17 18:54:43 +00:00
9b0c75cf7a oops - fixing accidental import mixup 2007-05-17 18:54:40 +00:00
2a17e2060c oops - fixing accidental import mixup 2007-05-17 18:54:29 +00:00
103c32fd7e Initial import 2007-05-17 04:01:16 +00:00
39588d9b69 oops 2007-03-29 16:54:10 +00:00
c0a5bf9803 FreeBSD amd64 2007-03-28 22:45:25 +00:00
b996fe1761 nicer error handling 2007-03-27 23:19:37 +00:00
1c56e863a8 have core catch more than just InvalidEncoding errors 2007-03-27 23:02:53 +00:00
54e68ef890 typo 2007-03-27 22:53:05 +00:00
1f3de637b4 fix bug that saved invalid torrents to the state, preventing deluge from starting again. 2007-03-27 22:44:00 +00:00
6870f0915b - 2007-03-27 22:20:57 +00:00
cc88d007e2 - 2007-03-27 22:13:09 +00:00
eeaa871761 setup configuration system detection 2007-03-27 20:32:45 +00:00
d677b4bd0f more default prefs 2007-03-26 21:23:47 +00:00
77d675c1bf version # 2007-03-26 21:13:14 +00:00
4f027326be - 2007-03-26 21:09:39 +00:00
286ff7dd9d limit share ratio to 3 digits in details pane 2007-03-26 05:36:26 +00:00
c3f90c4f80 pause right click action works 2007-03-26 05:33:16 +00:00
96967035cb - 2007-03-26 04:59:48 +00:00
feac6b3b67 - 2007-03-26 04:55:59 +00:00
0daf2283fc - 2007-03-26 04:55:53 +00:00
338ca35cf4 More UI work 2007-03-26 03:57:40 +00:00
1f352559ad fixed plugins preferences 2007-03-26 02:11:19 +00:00
811a4872f4 renamed a few things 2007-03-26 01:58:58 +00:00
be130c1e92 - 2007-03-26 01:19:08 +00:00
c59a92d0d6 dialogs 2007-03-26 01:03:00 +00:00
d903b033cc 2007-03-23 09:43:56 +00:00
8761e91ed0 interface work 2007-03-23 01:28:53 +00:00
085092fcf9 - 2007-03-23 00:27:21 +00:00
8462a4439d fix plugin dgl crash 2007-03-23 00:01:26 +00:00
4c97301478 use os.path.join() 2007-03-22 21:52:56 +00:00
d889759b5d New preferences dlg 2007-03-22 19:39:32 +00:00
eff1798503 - 2007-03-22 18:04:15 +00:00
76fde311c9 upnp libraries 2007-03-20 02:18:32 +00:00
74d666951c fix so search results will open 2007-03-20 02:00:05 +00:00
e80ba0d496 0.5 RELEASE 2007-03-18 16:35:04 +00:00
ca69c978a7 plugin api update 2007-03-18 16:23:08 +00:00
c54d87b69c updated translations 2007-03-18 16:01:10 +00:00
8ef143af72 Deluge 0.5 RC 2 2007-03-08 23:20:39 +00:00
79c6fa470d bugfix 2007-03-08 23:14:58 +00:00
1a53039d1a pause if no space rather than remove 2007-03-08 22:49:03 +00:00
61e48e249b won't start a download if isn't enough space 2007-03-08 22:14:40 +00:00
1059 changed files with 211571 additions and 33073 deletions

167
ChangeLog Normal file
View File

@ -0,0 +1,167 @@
Deluge 0.5.7.1 (01 December 2007)
* Tweak full hd warning so that it only displays itself once per torrent that
it has to pause.
* Fixed crash and corruption of persistent.state while adding a duplicate
torrent. Also caused yet another invalid handle error.
* Increase tracker timeout
Deluge 0.5.7 (26 November 2007)
* Scrape support
* Manual force-recheck
* Add local peer discovery (aka local service discovery)
* Blocklist plugin will now display errors, instead of just crashing on a bad
list or wrong type
* Add torrent in paused state option
* Add advanced progress bar
* Fix bug in merging trackers
* Various updates to WebUI, including https support and advanced template by vonck7
* Add maximum connection attempts per second preference
* Fix bug where loaded plugins were forgotten if Deluge crashed
* Fix ratio bugs (hopefully for the last time)
* Add preference to only show file selection popup if torrent has multiple files
* Fix pause all and resume all bugs
* Fix client not loading if our website goes down (new version check failing)
* Allow torrent creation with no trackers
* Scheduler plugin revamp by Ben Klein
* Fix ETA from going backwards
* UI warning on full HD - no longer just silently pauses torrents
* Replace SimpleRSS with FlexRSS
* Add preference for the location of torrent files
* Add autoload folder
* Copy translator credits from Launchpad to our about->credits
* Differentiate between queued and paused torrents. Able to pause queued
torrents - patch by yobbobandana
* Show error when writing/permission problems occur
Deluge 0.5.6.2 (31 October 2007)
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
as a size option.
* Fix a bug in Debian package that caused the UI to completely freeze when a
torrent finished
* Find and fix another shutdown bug that mostly Gutsy users were incountering
* Fix a couple of WebUI bugs, including the "index" page erroring out
Deluge 0.5.6.1 (28 October 2007)
* Fix invalid handle error
* Fix shutdown hang
Deluge 0.5.6 (24 October 2007)
* Web Interface Plugin
* Hopefully fix "losing data" and having to re-download parts (for real this time :p)
* Use new full allocation method which does not create files until one of its
pieces is downloaded
* Tray lock password is no longer stored in plain text
* Update the Scheduler plugin and fix a bunch of bugs on it
* Double-clicking on a torrent opens up its containing folder
* Fix SpeedLimiter plugin when setting upload limits
* Fix MoveTorrent plugin when moving actively downloading torrents
* Pause torrents while importing blocklist and resume them when finished
* Remove TorrentPieces and disable its use
* A whole bunch of stuff for Win32
* Add private flag to TorrentCreator plugin
* Use SVG for internal logo usage (except on Win32)
* Use theme for tray icon instead of hard-coded
* Properly release port on shutdown
* TorrentFiles plugin now has progress bars
* Removing torrent files no longer deletes files that werent part of the torrent
* New max half-open connections setting to deal with cheap/broken routers
* Inherit UPnP fixes from libtorrent
* Use threading for everything, instead of spawnning
Deluge 0.5.5 (09 September 2007)
* Editing a torrent's tracker list is now persistent between sessions
* Persistence between sessions for Speed Limiter, Web Seed and Desired Ratio
plugins
* New wizard to aid first-time users with configuration
* Reorderable tabs and remember order (with exception of details tab)
* Fix losing data and having to re-download parts
* Fix password lock showing when main window is not hidden
* Get rid of the plugin manager and integrate it into preferences
* New Move torrent plugin - takes over for "move completed downloads" feature
and provides a "Move Torrent" option when right-clicking on a torrent
* Save column widths
* Queue order after restart fixes.
* Use payload instead of including protocol overhead to ease user confusion
of seeding torrents "downloading"
* New Web Seed plugin for adding URLs to torrents for http seeding
* Add FAST-extension (http://www.bittorrent.org/fast_extensions.html)
Deluge 0.5.4.1 (10 August 2007)
* Add "Open containing folder" and "Open File" to the torrent and file
menu, respectively
* Load Blocklist plugin last and have it not lock up the interface during
import
* Add full allocation to preferences for clarification
* Catch SIGINT, SIGHUP, SIGTERM and Gnome logoff to quit properly
* Add send local info to developers
* Fix up pieces, peers and files plugins
* UPnP fixes
* Add ExtraStats plugin
* FreeBSD full allocation fix
* Added per torrent max upload slots and max connections preferences
* A lot of other less visible improvements
Deluge 0.5.4 (06 August 2007)
* Tray message includes session totals
* Ticket #198 - Display peers countries in the Peers tab.
* Ticket #474 - Multiple password prompts displayed
* Pause all/resume all in tray menu
* Peers and Files tabs are now plugins
* New Location plugin
* Option to use a random port every time
* Proxy system redone - you can now specify different information for each
type of proxy (DHT, peer, tracker, web-seed)
* TorrentPieces plugin to view piece updates and show pieces table per file
* EventLogger plugin to view/log every activity
* SpeedLimiter plugin, which allows you to set speed limits on a per-torrent
basis
* New release alerts - Client will inform user if their version of deluge is
outdated
Deluge 0.5.3 (25 July 2007)
* Added ChangeLog
* Ticket #53 - Added files priorities within torrent
* Ticket #111 - Remember directory of last added torrent
* Ticket #232 - Added Move completed downloads to feature
* Ticket #245 - Added ability to select torrent files before starting
* Ticked #368 - Added ability to prioritize first and last pieces of files
in torrents
* Ticket #371 - Proper full storage allocation of files on reiser4 and
ntfs-3g filesystems
* Ticket #420 - Show size of torrent minus size of unselected files as Total
Size
* Ticket #405 - Properly start in tray when run deluge --tray
* Ticket #437 - Gracefully upgrade from old versions
* Picking a file to not download now checks for compact_mode status to prevent
all sorts of problems such as downloading pieces into the wrong file
* RSS plugin inclusion
* Added ability to queue new torrents above completed ones when
seeds are set to queue at the bottom
* Added availability and piece size display in details, availailability
column
* Added ability to automatically remove torrents when max share ratio is set
* Show text from clipboard in Add URL dialog only if it looks like an URL
* Added Torrent Notification plugin
* Added event handling callbacks for plugins
* Added ability to designate a torrent as private (in file selection dialog)
* Added merging trackers of duplicate torrents
* Details, Peers and Files tabs more responsible and their perfomance
greatly improved especially on torrents with many files and peers
* A lot of other less visible improvements
Deluge 0.5.2 (05 July 2007)
* ticket #6 - Torrent creation built into main client
* ticket #315 - Plugins implemented as modules
* ticket #310 - Configuration options for PEX and UPnP
* ticket #390 - Individual file progress shown in File tab
* The usual slew of improvements
Deluge 0.5.1 (11 June 2007)
* Peer Exchange
* ticket #254 - Encryption
* ticket #142 - UPnP + NATPMP
* Improved user interface
* Redesigned preferences dialog
* Proper startup and shutdown

40
HACKING Normal file
View File

@ -0,0 +1,40 @@
# Copyright (c) 2006 Marcos Pinto ('markybob') <markybob@gmail.com>
This is pretty much taken straight out of PEP 8, the "Style Guide for Python
Code" (http://www.python.org/dev/peps/pep-0008/)
More or less, if you try to submit a patch that doesn't follow this guide, odds
are your patch will be denied...unless it does some incredibly magnificient
things, in which case I *might* edit it. Don't bet on it, though.
Here are the highlights:
Indents are FOUR (4) spaces. Not 8, not 5 or 2 and definitely NOT tab.
Limit all lines to a maximum of 80 characters.
Use UTF-8 encoding
Every single import should be on its own line
Avoid extraneous whitespace in the following situations:
Yes: spam(ham[1], {eggs: 2})
No: spam( ham[ 1 ], { eggs: 2 } )
Yes: spam(1)
No: spam (1)
Yes: if x == 4: print x, y; x, y = y, x
No: if x == 4 : print x , y ; x , y = y , x
Yes: dict['key'] = list[index]
No: dict ['key'] = list [index]
Yes:
x = 1
y = 2
long_variable = 3
No:
x = 1
y = 2
long_variable = 3
Some more recommendations:
* "Don't repeat yourself (DRY). Every distinct concept and/or piece of
data should live in one, and only one, place. Redundancy is bad.
Normalization is good." (taken straight from django's Design philosophies)
* Try to use iterators/generators where applicable. The simplest change from
range to xrange is also good.
* In UI and deluge code for consistency we use notion of speed not rate.
Libtorrent mixes this usage and so do we on deluge-libtorrent boundary,
but all deluge only code should use speed.

12
LICENSE
View File

@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
@ -338,3 +338,13 @@ proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
In addition, as a special exception, the copyright holders give
permission to link the code of portions of this program with the OpenSSL
library.
You must obey the GNU General Public License in all respects for all of
the code used other than OpenSSL. If you modify file(s) with this
exception, you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so, delete
this exception statement from your version. If you delete this exception
statement from all source files in the program, then also delete it here.

View File

@ -1,10 +1,12 @@
include LICENSE
include README
include README.Packagers
include Makefile
include deluge.desktop
include deluge.xpm
include deluge.png
include msgfmt.py
recursive-include libtorrent/ *
recursive-include glade/ *.glade
recursive-include pixmaps/ *.png
recursive-include pixmaps/ *.png *.svg
recursive-include plugins/ *
recursive-include po/ *

31
Makefile Normal file
View File

@ -0,0 +1,31 @@
#
# Makefile for Deluge
#
PYVER=`python -c "import sys; print sys.version[:3]"`
PREFIX ?= /usr
DESTDIR ?= ./
all:
python setup.py build
tarball:
python setup.py sdist
mv dist/deluge-*.tar.gz $(DESTDIR)
install:
python setup.py install --prefix=$(PREFIX)
clean:
python setup.py clean
rm -rf ./build
rm msgfmt.pyc
find . -name *.pyc -exec rm {} \;
uninstall:
-rm $(PREFIX)/bin/deluge
-rm -r $(PREFIX)/lib/python${PYVER}/site-packages/deluge
-rm -r $(PREFIX)/lib/python${PYVER}/site-packages/deluge-*.egg-info
-rm -r $(PREFIX)/share/deluge
-find ${PREFIX}/share/locale -name deluge.mo -exec rm {} \;
-rm $(PREFIX)/share/applications/deluge.desktop
-rm $(PREFIX)/share/pixmaps/deluge.png

10
PKG-INFO Normal file
View File

@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: deluge
Version: 0.5.2
Summary: A bittorrent client written in PyGTK
Home-page: http://deluge-torrent.org
Author: Zach Tibbitts, Alon Zakai, Marcos Pinto, Alex Dedul, Andrew Resch
Author-email: zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, rotmer@gmail.com, alonzakai@gmail.com
License: GPLv2
Description: UNKNOWN
Platform: UNKNOWN

101
README
View File

@ -1,57 +1,102 @@
Deluge BitTorrent Client
==========================
Deluge BitTorrent Client
==========================
Authors:
Zach Tibbitts, aka zachtib
Alon Zakai, aka kripkenstein
Marcos Pinto, aka markybob
Andrew Resch, aka andar
Alex Dedul, aka plisk
Homepage: http://deluge-torrent.org
==========================
Contact/Support:
==========================
We have two options available for support:
Our Forum, at http://forum.deluge-torrent.org
or
Our IRC Channel, at #deluge on Freenode
==========================
Installation Instructions:
==========================
First, make sure you have the proper bulid
dependencies installed. On a normal Debian
or Ubuntu system, those dependencies are:
First, make sure you have the proper build dependencies installed. On a normal
Debian or Ubuntu system, those dependencies are:
g++
make
python-all-dev
python-all
python-all version >= 2.4
python-dbus
python-gtk2 version >= 2.9
python-notify
python-pyopenssl
librsvg2-common
python-xdg
python-support
libboost-dev
libboost-dev >= 1.33.1
libboost-thread-dev
libboost-date-time-dev
libboost-filesystem-dev
libboost-serialization-dev
libboost-program-options-dev
libboost-regex-dev
libssl-dev
zlib1g-dev
But the names of the packages may vary
depending on your OS / distro.
But the names of the packages may vary depending on your OS / distro.
Once you have the needed libraries installed,
build Deluge by running:
Once you have the needed libraries installed, build Deluge by running:
python setup.py build
$ make
You shouldn't get any errors. Then run, as
root (or by using sudo):
You shouldn't get any errors. Then run, as root (or by using sudo):
python setup.py install
$ make install
and Deluge will be installed.
and Deluge will be installed. By default, Deluge will be installed to the
prefix /usr. If you wish, you can install Deluge to a different prefix by
specifying it when you install it:
$ PREFIX=yourprefixhere make install
So, to install to /usr/local, run:
$ PREFIX=/usr/local make install
You can then run Deluge by executing:
deluge
Notes:
$ deluge
1) On some distributions, boost libraries are
renamed to have "-mt" at the end (boost_thread_mt
instead of boost_thread, for example), the "mt"
indicating "multithreaded". In some cases it
appears the distros lack symlinks to connect
things. The solution is to either add symlinks
from the short names to those with "-mt", or to
alter setup.py to look for the "-mt" versions.
==========================
Uninstallation/Upgrading:
==========================
If you wish to upgrade from the older Deluge version please remove it first,
then install the latest version as per "Installation Instructions". If you
installed via the tarball, cd into the unpacked source tarball and then run,
as root (or by using sudo):
$ make uninstall
If you installed via the deb package, run as root (or by using sudo:)
$ dpkg --purge remove deluge-torrent
Now install the latest version (and check out the additional notes).
==========================
Additional Notes:
==========================
1) On some distributions, boost libraries are renamed to have "-mt" at the end
(boost_thread_mt instead of boost_thread, for example), the "mt" indicating
"multithreaded". In some cases it appears the distros lack symlinks to connect
things. The solution is to either add symlinks from the short names to those
with "-mt", or to alter setup.py to look for the "-mt" versions.
2) After upgrading your Deluge installation, it may fail to start. If this
happens to you, you need to remove your ~/.config/deluge directory to allow
Deluge to rebuild it's configuration file.

8
README.Packagers Normal file
View File

@ -0,0 +1,8 @@
NOTE: Deluge 0.5.1 and newer uses an svn build of libtorrent. This build
differs from a clean libtorrent source checkout and has been hacked in order
to get it to work properly with Deluge. As a result, Deluge will likely not
build properly against a vanilla libtorrent 0.12 installation or a nightly
build oflibtorrent 0.13. It is recommended that you build against our included
libtorrent, as our build will not conflict with any installed libtorrent.
- zachtib

3
TODO Normal file
View File

@ -0,0 +1,3 @@
for 0.5.7
* remap filenames
* copy over active torrents when user changes location of torrent files

5
createicons.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
for size in 16 22 24 32 36 48 64 72 96 128 192 256; do mkdir -p icons/hicolor/\
${size}x${size}/apps; rsvg-convert -w ${size} -h ${size} \
-o icons/hicolor/${size}x${size}/apps/deluge.png pixmaps/deluge.svg; mkdir -p \
icons/scalable/apps/; cp pixmaps/deluge.svg icons/scalable/apps/deluge.svg; done

View File

@ -2,11 +2,12 @@
Version=1.0
Encoding=UTF-8
Name=Deluge BitTorrent Client
Comment=Bittorrent client written in Python/PyGTK
GenericName=BitTorrent Client
Comment=A GTK BitTorrent client written in Python and C++
Exec=deluge
Icon=deluge.xpm
Icon=deluge.png
Terminal=false
Type=Application
Categories=Application;Network
Categories=Network;
StartupNotify=true
MimeType=application/x-bittorrent;

BIN
deluge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1,415 +0,0 @@
/* XPM */
static char * deluge_torrent_xpm[] = {
"32 32 380 2",
" c None",
". c #8893A8",
"+ c #8994A8",
"@ c #B0B7C5",
"# c #919BAE",
"$ c #737F98",
"% c #A3ABBB",
"& c #8E98AD",
"* c #AEB5C4",
"= c #858FA5",
"- c #5E6D89",
"; c #929CB0",
"> c #8794A9",
", c #8592AA",
"' c #919FB5",
") c #A5B0C3",
"! c #7688A4",
"~ c #7687A1",
"{ c #8A99B1",
"] c #768AA7",
"^ c #7E92AE",
"/ c #8397B3",
"( c #92A4BD",
"_ c #96A8C0",
": c #5B7295",
"< c #8B9DB7",
"[ c #6A83A4",
"} c #728BAD",
"| c #7791B3",
"1 c #7B95B6",
"2 c #7C96B8",
"3 c #95ABC6",
"4 c #829CBC",
"5 c #45618C",
"6 c #7F96B3",
"7 c #6483A9",
"8 c #6384AC",
"9 c #6B8BB3",
"0 c #7091B8",
"a c #7495BC",
"b c #7596BD",
"c c #7496BD",
"d c #95AECC",
"e c #6F91B9",
"f c #6081A9",
"g c #3C6292",
"h c #365989",
"i c #4B6B97",
"j c #5676A1",
"k c #5F81AB",
"l c #6E93BF",
"m c #7097C2",
"n c #7297C3",
"o c #8FADCE",
"p c #618AB7",
"q c #476D9D",
"r c #5A779F",
"s c #1B4075",
"t c #1F4377",
"u c #365785",
"v c #4A6791",
"w c #4D6B94",
"x c #5D80AA",
"y c #6C93BF",
"z c #779DC6",
"A c #84A6CB",
"B c #5382B6",
"C c #3A659A",
"D c #5C789F",
"E c #224579",
"F c #1E4277",
"G c #274A7C",
"H c #2E4F7F",
"I c #335483",
"J c #44628D",
"K c #557197",
"L c #526E95",
"M c #506F99",
"N c #668FBD",
"O c #7FA3CA",
"P c #7299C4",
"Q c #36639A",
"R c #4F6D97",
"S c #345484",
"T c #305181",
"U c #42618A",
"V c #4E6992",
"W c #4A678F",
"X c #4B6992",
"Y c #4B6994",
"Z c #5F7A9E",
"` c #5E779C",
" . c #597398",
".. c #527099",
"+. c #618ABA",
"@. c #84A6CD",
"#. c #5D89BB",
"$. c #375A89",
"%. c #4C6992",
"&. c #3A5986",
"*. c #536E94",
"=. c #577197",
"-. c #6F92BB",
";. c #759ECA",
">. c #739CCA",
",. c #759DC9",
"'. c #6880A4",
"). c #5C7699",
"!. c #4F6F98",
"~. c #618DBD",
"{. c #81A4CA",
"]. c #4B7CB3",
"^. c #274F84",
"/. c #5A759B",
"(. c #375784",
"_. c #577196",
":. c #5A7498",
"<. c #6F89AB",
"[. c #8BADD1",
"}. c #7EA5D0",
"|. c #7FA6D0",
"1. c #7CA4CF",
"2. c #7CA4CE",
"3. c #789FC7",
"4. c #6984A7",
"5. c #5A7398",
"6. c #5076A5",
"7. c #6791C0",
"8. c #7198C3",
"9. c #2D5081",
"0. c #25477A",
"a. c #4C6890",
"b. c #627A9D",
"c. c #657DA1",
"d. c #A0BBD7",
"e. c #89AED6",
"f. c #8BAFD7",
"g. c #8BB0D7",
"h. c #8AAED6",
"i. c #86ACD4",
"j. c #82A8D2",
"k. c #7CA3CF",
"l. c #749DC8",
"m. c #6984A6",
"n. c #567298",
"o. c #5786BA",
"p. c #779CC6",
"q. c #5583B7",
"r. c #295086",
"s. c #2C4E7F",
"t. c #345483",
"u. c #5B7498",
"v. c #5D7699",
"w. c #93AAC4",
"x. c #9EBDDD",
"y. c #96B8DD",
"z. c #97B9DE",
"A. c #94B7DC",
"B. c #90B3DA",
"C. c #8AAFD6",
"D. c #83A9D2",
"E. c #7AA2CE",
"F. c #6F95BF",
"G. c #667E9F",
"H. c #577FAF",
"I. c #5585B8",
"J. c #759AC5",
"K. c #3F6FA7",
"L. c #254A80",
"M. c #5C769C",
"N. c #3C5B87",
"O. c #60789C",
"P. c #B0C3D8",
"Q. c #A1C0E3",
"R. c #A3C2E4",
"S. c #A3C3E5",
"T. c #A2C2E4",
"U. c #9EBFE2",
"V. c #98BADE",
"W. c #91B4DA",
"X. c #88AED6",
"Y. c #759ECB",
"Z. c #6885AD",
"`. c #5780B0",
" + c #5383B8",
".+ c #7299C3",
"++ c #4675AB",
"@+ c #395A89",
"#+ c #46648F",
"$+ c #3E5D88",
"%+ c #617A9C",
"&+ c #637B9D",
"*+ c #BFD1E4",
"=+ c #ADCBEA",
"-+ c #B0CDEB",
";+ c #AFCCEB",
">+ c #ACCAE9",
",+ c #A7C6E6",
"'+ c #9FC0E2",
")+ c #8DB1D8",
"!+ c #82A9D2",
"~+ c #77A0CC",
"{+ c #6A94C4",
"]+ c #5F8DBF",
"^+ c #5C89BA",
"/+ c #5C85B4",
"(+ c #3F5E8B",
"_+ c #3B5A86",
":+ c #647C9E",
"<+ c #61799D",
"[+ c #C1D2E4",
"}+ c #BBD5F1",
"|+ c #BCD6F2",
"1+ c #BAD5F1",
"2+ c #B5D1EE",
"3+ c #AECBEA",
"4+ c #A5C4E5",
"5+ c #9BBCE0",
"6+ c #84AAD3",
"7+ c #78A0CC",
"8+ c #6B96C6",
"9+ c #5F8CBF",
"0+ c #5282B8",
"a+ c #4F7FB4",
"b+ c #668CB7",
"c+ c #43618D",
"d+ c #325382",
"e+ c #5E779B",
"f+ c #5F789A",
"g+ c #BACADC",
"h+ c #C9E0F9",
"i+ c #C7DFF8",
"j+ c #C3DCF6",
"k+ c #BCD7F2",
"l+ c #B3CFED",
"m+ c #A8C7E7",
"n+ c #9DBEE1",
"o+ c #6A96C5",
"p+ c #5D8BBE",
"q+ c #5081B7",
"r+ c #497BB2",
"s+ c #698DB7",
"t+ c #45638E",
"u+ c #2E5080",
"v+ c #25487B",
"w+ c #506B93",
"x+ c #647B9E",
"y+ c #9DAFC7",
"z+ c #D6E9FD",
"A+ c #D1E8FE",
"B+ c #CAE2FA",
"C+ c #C1DAF5",
"D+ c #A9C8E8",
"E+ c #6894C4",
"F+ c #5A89BC",
"G+ c #4D7EB5",
"H+ c #4577AF",
"I+ c #6B8DB5",
"J+ c #3B6090",
"K+ c #3D5D8A",
"L+ c #3C5B89",
"M+ c #1D4276",
"N+ c #647C9C",
"O+ c #657D9E",
"P+ c #C2D4E6",
"Q+ c #D3E9FF",
"R+ c #CEE5FC",
"S+ c #C2DBF5",
"T+ c #80A7D1",
"U+ c #729CC9",
"V+ c #6491C2",
"W+ c #5686BA",
"X+ c #497BB3",
"Y+ c #5580B3",
"Z+ c #5B7EAA",
"`+ c #335686",
" @ c #4D6993",
".@ c #26497B",
"+@ c #4C6990",
"@@ c #6B82A2",
"#@ c #7D92B0",
"$@ c #C1D4E9",
"%@ c #C0DAF4",
"&@ c #B2CFED",
"*@ c #7BA3CE",
"=@ c #6F99C7",
"-@ c #6390C0",
";@ c #5886B9",
">@ c #4A7BB2",
",@ c #698CB7",
"'@ c #4C6F9C",
")@ c #284C7F",
"!@ c #577299",
"~@ c #2F517F",
"{@ c #536E93",
"]@ c #7086A5",
"^@ c #7B8FAC",
"/@ c #9FB3CD",
"(@ c #B8D2EE",
"_@ c #91B5DB",
":@ c #85ABD4",
"<@ c #7CA3CD",
"[@ c #729AC8",
"}@ c #6791C1",
"|@ c #5A87BA",
"1@ c #5280B4",
"2@ c #7A97BB",
"3@ c #416290",
"4@ c #2F5080",
"5@ c #4F6B91",
"6@ c #687F9F",
"7@ c #7B8FAB",
"8@ c #8396B0",
"9@ c #8AA1BF",
"0@ c #8CACCE",
"a@ c #8FB2D8",
"b@ c #86AAD2",
"c@ c #7DA3CC",
"d@ c #749BC7",
"e@ c #6993C1",
"f@ c #5B88B9",
"g@ c #7999C0",
"h@ c #587AA5",
"i@ c #21416E",
"j@ c #516D96",
"k@ c #415F8A",
"l@ c #567196",
"m@ c #637B9E",
"n@ c #6F84A3",
"o@ c #778BA7",
"p@ c #758BAA",
"q@ c #7490B3",
"r@ c #749BC5",
"s@ c #6992C0",
"t@ c #799DC4",
"u@ c #7291B6",
"v@ c #46658C",
"w@ c #264878",
"x@ c #4F6C94",
"y@ c #42608C",
"z@ c #294B7D",
"A@ c #4A6790",
"B@ c #567095",
"C@ c #597599",
"D@ c #587398",
"E@ c #536F96",
"F@ c #4F6D95",
"G@ c #7690B4",
"H@ c #7090B7",
"I@ c #4A6991",
"J@ c #2B4871",
"K@ c #41608C",
"L@ c #59749A",
"M@ c #234679",
"N@ c #214578",
"O@ c #3A5A87",
"P@ c #47648F",
"Q@ c #667EA2",
"R@ c #7188A9",
"S@ c #4B6892",
"T@ c #395985",
"U@ c #1C314F",
"V@ c #2E4F7D",
"W@ c #395986",
"X@ c #526E96",
"Y@ c #58739A",
"Z@ c #5B759B",
"`@ c #6A82A5",
" # c #627CA0",
".# c #365887",
"+# c #324B69",
"@# c #344B69",
"## c #34537D",
"$# c #294C7C",
"%# c #315383",
"&# c #40618D",
"*# c #40638F",
"=# c #3B5C87",
"-# c #36537A",
";# c #2E4156",
" ",
" . ",
" + @ # ",
" $ % & * = ",
" - ; > , ' ) ! ",
" ~ { ] ^ / ( _ ",
" : < [ } | 1 2 3 4 ",
" 5 6 7 8 9 0 a b c d e ",
" 7 f g h i j k l m n o p ",
" q r s s s t u v w x y z A B ",
" C D E s F G H I J K L M N O P ",
" Q R S s T U V W X Y Z ` ...+.@.#. ",
" $.%.t &.*.=.r -.;.>.,.0 '.).!.~.{.]. ",
" ^./.F (._.:.<.[.}.|.}.1.2.3.4.5.6.7.8. ",
" 9.v 0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q. ",
" r.v s.t.u.v.w.x.y.z.z.A.B.C.D.E.F.G.H.I.J.K. ",
" L.M.s N.b.O.P.Q.R.S.T.U.V.W.X.|.Y.Z.`. +.+++ ",
" @+#+s $+%+&+*+=+-+;+>+,+'+z.)+!+~+{+]+ +^+/+ ",
" (+S s _+:+<+[+}+|+1+2+3+4+5+B.6+7+8+9+0+a+b+ ",
" c+T s d+e+f+g+h+i+j+k+l+m+n+W.6+~+o+p+q+r+s+ ",
" t+u+s v+w+x+y+z+A+B+C+2+D+n+B.D.Y.E+F+G+H+I+J+ ",
" K+L+s M+N.N+O+P+Q+R+S+2+m+5+)+T+U+V+W+X+Y+Z+ ",
" `+ @s s .@+@@@#@$@R+%@&@4+z.e.*@=@-@;@>@,@'@ ",
" )@!@t s s ~@{@]@^@/@(@=+'+_@:@<@[@}@|@1@2@3@ ",
" S #+s s s 4@5@6@7@8@9@0@a@b@c@d@e@f@g@h@ ",
" i@j@u s s s G k@l@m@n@o@p@q@a r@s@t@u@v@ ",
" w@x@y@s s s s z@_+A@B@C@D@E@F@G@H@I@ ",
" J@K@L@y@M@s s N@z@S O@P@Q@R@S@T@ ",
" U@V@W@X@L@Y@Z@L@c.`@ #v .#+# ",
" @###$#%#&#*#=#-#;# ",
" ",
" "};

View File

@ -8,8 +8,9 @@
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="has_separator">False</property>
<property name="website">http://deluge-torrent.org</property>
<property name="website"></property>
<property name="authors"></property>
<property name="translator-credits"></property>
<property name="documenters"></property>
<property name="artists"></property>
<child internal-child="vbox">

File diff suppressed because it is too large Load Diff

View File

@ -1,82 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.1.5 on Thu Feb 22 19:15:41 2007 by zach@notapowerbook-->
<!--Generated with glade3 3.2.2 on Sun Jul 15 01:54:03 2007 by markybob@peg-->
<glade-interface>
<widget class="GtkMenu" id="torrent_popup">
<property name="visible">True</property>
<child>
<widget class="GtkCheckMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="label" translatable="yes">Size</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="size_toggle"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="label" translatable="yes">Status</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="status_toggle"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="menuitem3">
<property name="visible">True</property>
<property name="label" translatable="yes">Seeders</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="seeders_toggle"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="label" translatable="yes">Peers</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="peers_toggle"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="menuitem5">
<property name="visible">True</property>
<property name="label" translatable="yes">Download Speed</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="dl_toggle"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="menuitem6">
<property name="visible">True</property>
<property name="label" translatable="yes">Upload Speed</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="ul_toggle"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="menuitem7">
<property name="visible">True</property>
<property name="label" translatable="yes">Time Remaining</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="eta_toggle"/>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="menuitem8">
<property name="visible">True</property>
<property name="label" translatable="yes">Share Ratio</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="share_toggle"/>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="remove_torrent_dlg">
<property name="title" translatable="yes">Remove Torrent</property>
<property name="destroy_with_parent">True</property>
@ -90,41 +15,103 @@
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="label1">
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Are you sure you want to remove the selected torrent(s) from Deluge?&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">3</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">6</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;span size="large"&gt;&lt;b&gt;Are you sure you want to remove the selected torrent(s) from Deluge?&lt;/b&gt;&lt;/span&gt;</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
</widget>
<packing>
<property name="padding">10</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">10</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="data_also">
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="label" translatable="yes">Delete downloaded files</property>
<property name="draw_indicator">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">20</property>
<child>
<widget class="GtkCheckButton" id="data_also">
<property name="visible">True</property>
<property name="label" translatable="yes">Delete downloaded files</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="bottom_padding">5</property>
<property name="left_padding">20</property>
<child>
<widget class="GtkCheckButton" id="torrent_also">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Delete .torrent file</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="warning">
<property name="visible">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
@ -135,14 +122,15 @@
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="label">gtk-no</property>
<property name="label" translatable="no">gtk-no</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="label">gtk-yes</property>
<property name="label" translatable="no">gtk-yes</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
</widget>
@ -209,7 +197,7 @@
<child>
<widget class="GtkImageMenuItem" id="menuitem12">
<property name="visible">True</property>
<property name="label" translatable="yes">gtk-preferences</property>
<property name="label" translatable="no">gtk-preferences</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="preferences"/>
@ -239,11 +227,105 @@
<child>
<widget class="GtkImageMenuItem" id="menuitem14">
<property name="visible">True</property>
<property name="label" translatable="yes">gtk-quit</property>
<property name="label" translatable="no">gtk-quit</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="quit"/>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="speed_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="skip_taskbar_hint">True</property>
<property name="decorated">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">2</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="spin_title">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="is_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="activates_default">True</property>
<property name="xalign">1</property>
<property name="adjustment">0 -1 10000 1 10 10</property>
<property name="numeric">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="no">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="no">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1,731 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
<widget class="GtkDialog" id="pref_dialog">
<property name="width_request">480</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Preferences Dialog</property>
<property name="default_width">583</property>
<property name="default_height">431</property>
<property name="destroy_with_parent">True</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="spacing">2</property>
<child>
<widget class="GtkNotebook" id="pref_notebook">
<property name="visible">True</property>
<child>
<widget class="GtkScrolledWindow" id="gen_options">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<child>
<widget class="GtkViewport" id="viewport2">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="resize_mode">GTK_RESIZE_IMMEDIATE</property>
<child>
<widget class="GtkExpander" id="expander6">
<property name="visible">True</property>
<property name="expanded">True</property>
<child>
<widget class="GtkTable" id="table5">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkCheckButton" id="chk_use_tray">
<property name="visible">True</property>
<property name="label" translatable="yes">Enable system tray icon</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="tray_toggle"/>
</widget>
<packing>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_min_on_close">
<property name="visible">True</property>
<property name="label" translatable="yes">Minimize to tray on close</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">12</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label29">
<property name="visible">True</property>
<property name="label" translatable="yes">Options</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="expander1">
<property name="visible">True</property>
<property name="expanded">True</property>
<child>
<widget class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkFileChooserButton" id="download_path_button">
<property name="visible">True</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radio_save_all_to">
<property name="visible">True</property>
<property name="label" translatable="yes">Save all downloads to:</property>
<property name="draw_indicator">True</property>
<property name="group">radio_ask_save</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radio_ask_save">
<property name="visible">True</property>
<property name="label" translatable="yes">Ask me where to save each download</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="right_attach">2</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="label" translatable="yes">Save Location</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="expander2">
<property name="visible">True</property>
<property name="expanded">True</property>
<child>
<widget class="GtkTable" id="table4">
<property name="visible">True</property>
<property name="n_rows">1</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkSpinButton" id="ratio_spinner">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">5</property>
<property name="xalign">0.5</property>
<property name="adjustment">1 0 10 0.10000000000000001 10 10</property>
<property name="climb_rate">0.05000000074505806</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_autoseed">
<property name="visible">True</property>
<property name="label" translatable="yes">Stop seeding torrents when
their share ratio reaches:</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label21">
<property name="visible">True</property>
<property name="label" translatable="yes">Seeding</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="expander3">
<property name="visible">True</property>
<property name="expanded">True</property>
<child>
<widget class="GtkCheckButton" id="chk_compact">
<property name="visible">True</property>
<property name="label" translatable="yes">Use compact storage allocation</property>
<property name="draw_indicator">True</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="label" translatable="yes">Storage</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="label" translatable="yes">General</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="tab_expand">False</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="net_options">
<property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<child>
<widget class="GtkViewport" id="viewport3">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<child>
<widget class="GtkExpander" id="expander5">
<property name="visible">True</property>
<property name="expanded">True</property>
<child>
<widget class="GtkTable" id="table6">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">4</property>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="label25">
<property name="visible">True</property>
<property name="label" translatable="yes">Try from:</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label26">
<property name="visible">True</property>
<property name="label" translatable="yes">to:</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_min">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="adjustment">0 0 65535 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_max">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="xalign">0.5</property>
<property name="adjustment">0 0 65535 1 10 10</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label27">
<property name="visible">True</property>
<property name="label" translatable="yes">Active port:</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="active_port_label">
<property name="visible">True</property>
<property name="label" translatable="yes">0000</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="btn_test_port">
<property name="label" translatable="yes">Test Port</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="label" translatable="yes">TCP Port</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="expander4">
<property name="visible">True</property>
<property name="expanded">True</property>
<child>
<widget class="GtkTable" id="table7">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">3</property>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;i&gt;(-1 is unlimited)&lt;/i&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">KB/s</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_download">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">0 -1 2048 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_num_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">0 -1 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Download Rate:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Upload Slots</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Connections</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_num_download">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">0 -1 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Rate:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">10</property>
<property name="xalign">1</property>
<property name="adjustment">0 -1 1024 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">KB/s</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="label" translatable="yes">Bandwidth </property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
<property name="tab_expand">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="label" translatable="yes">Network</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">1</property>
<property name="tab_expand">False</property>
<property name="tab_fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button5">
<property name="visible">True</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button4">
<property name="visible">True</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="plugin_dialog">
<property name="width_request">480</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Plugin Manager</property>
<property name="default_width">583</property>
<property name="default_height">431</property>
<property name="destroy_with_parent">True</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="spacing">2</property>
<child>
<widget class="GtkNotebook" id="pref_notebook1">
<property name="visible">True</property>
<property name="show_tabs">False</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<child>
<widget class="GtkTreeView" id="plugin_view">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<child>
<widget class="GtkTextView" id="plugin_text">
<property name="visible">True</property>
<property name="editable">False</property>
<property name="wrap_mode">GTK_WRAP_WORD</property>
<property name="cursor_visible">False</property>
</widget>
<packing>
<property name="padding">10</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
<child>
<widget class="GtkButton" id="plugin_conf">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">gtk-preferences</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="plugin_pref"/>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">10</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label34">
<property name="visible">True</property>
<property name="label" translatable="yes">Plugins</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="tab_expand">False</property>
<property name="tab_fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button10">
<property name="visible">True</property>
<property name="label" translatable="yes">gtk-close</property>
<property name="use_stock">True</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

120
glade/edit_trackers.glade Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.2 on Wed Jun 27 17:27:11 2007 by markybob@peg-->
<glade-interface>
<widget class="GtkWindow" id="edittrackers">
<property name="width_request">300</property>
<property name="height_request">200</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="title" translatable="yes">Edit Trackers</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="height_request">36</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Tracker Editing</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<child>
<widget class="GtkTextView" id="txt_tracker_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkAspectFrame" id="aspectframe1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="ratio">1</property>
<child>
<placeholder/>
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="no">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="cancel_button_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="no">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="ok_button_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkAspectFrame" id="aspectframe2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="ratio">1</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

126
glade/file_tab_menu.glade Normal file
View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
<widget class="GtkMenu" id="file_tab_menu">
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="open_file">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Open File</property>
<property name="use_underline">True</property>
<signal name="activate" handler="open_file"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="open_file_separator">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="select_all">
<property name="visible">True</property>
<property name="label" translatable="yes">Select All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="select_all"/>
<child internal-child="image">
<widget class="GtkImage" id="image22">
<property name="visible">True</property>
<property name="stock">gtk-select-all</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="unselect_all">
<property name="visible">True</property>
<property name="label" translatable="yes">Unselect All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="unselect_all"/>
<child internal-child="image">
<widget class="GtkImage" id="image23">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="priority_dont_download">
<property name="visible">True</property>
<property name="label" translatable="yes">Don't download</property>
<property name="use_underline">True</property>
<signal name="activate" handler="priority_dont_download"/>
<child internal-child="image">
<widget class="GtkImage" id="image24">
<property name="visible">True</property>
<property name="stock">gtk-ok</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="priority_normal">
<property name="visible">True</property>
<property name="label" translatable="yes">Normal</property>
<property name="use_underline">True</property>
<signal name="activate" handler="priority_normal"/>
<child internal-child="image">
<widget class="GtkImage" id="image25">
<property name="visible">True</property>
<property name="stock">gtk-ok</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="priority_high">
<property name="visible">True</property>
<property name="label" translatable="yes">High</property>
<property name="use_underline">True</property>
<signal name="activate" handler="priority_high"/>
<child internal-child="image">
<widget class="GtkImage" id="image26">
<property name="visible">True</property>
<property name="stock">gtk-ok</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="priority_highest">
<property name="visible">True</property>
<property name="label" translatable="yes">Highest</property>
<property name="use_underline">True</property>
<signal name="activate" handler="priority_highest"/>
<child internal-child="image">
<widget class="GtkImage" id="image27">
<property name="visible">True</property>
<property name="stock">gtk-ok</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface>

85
glade/files_dialog.glade Normal file
View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
<widget class="GtkDialog" id="file_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Deluge File Selection</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<property name="default_width">550</property>
<property name="default_height">550</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
<property name="visible">True</property>
<property name="spacing">1</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<widget class="GtkTreeView" id="file_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">2</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_setpriv">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Torrent will not be distributed on the trackerless (DHT) network</property>
<property name="label" translatable="yes">Set the private flag</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="label" translatable="no">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="label" translatable="no">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

59
glade/merge_dialog.glade Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
<widget class="GtkDialog" id="merge_dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Deluge Merge Tracker Lists</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<property name="default_width">200</property>
<property name="default_height">50</property>
<property name="has_separator">False</property>
<property name="destroy_with_parent">True</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="spacing">2</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Torrent already detected in Deluge, would you like to merge the tracker lists?</property>
</widget>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button_cancel">
<property name="visible">True</property>
<property name="label" translatable="no">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button_ok">
<property name="visible">True</property>
<property name="label" translatable="no">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

File diff suppressed because it is too large Load Diff

View File

@ -5,64 +5,255 @@
<widget class="GtkMenu" id="torrent_menu">
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="menuitem5">
<widget class="GtkImageMenuItem" id="menu_resume">
<property name="visible">True</property>
<property name="label" translatable="yes">Update Tracker</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Force Recheck</property>
<property name="use_underline">True</property>
<signal name="activate" handler="update_tracker"/>
<signal name="activate" handler="torrent_recheck"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image5">
<widget class="GtkImage" id="menu-item-image13">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-refresh</property>
<property name="stock">gtk-redo</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem6">
<widget class="GtkSeparatorMenuItem" id="separator">
<property name="visible">True</property>
<property name="label" translatable="yes">Queue Up</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menu_resume">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Re_sume</property>
<property name="use_underline">True</property>
<signal name="activate" handler="queue_up"/>
<signal name="activate" handler="tor_start"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image6">
<widget class="GtkImage" id="menu-item-image13">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-go-up</property>
<property name="stock">gtk-media-play</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem7">
<widget class="GtkImageMenuItem" id="menu_pause">
<property name="visible">True</property>
<property name="label" translatable="yes">Queue Down</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Pause</property>
<property name="use_underline">True</property>
<signal name="activate" handler="queue_down"/>
<signal name="activate" handler="tor_pause"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image7">
<widget class="GtkImage" id="menu-item-image14">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-go-down</property>
<property name="stock">gtk-media-pause</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem8">
<widget class="GtkSeparatorMenuItem" id="separator">
<property name="visible">True</property>
<property name="label" translatable="yes">Queue to Bottom</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem12">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Remove Torrent</property>
<property name="use_underline">True</property>
<signal name="activate" handler="queue_bottom"/>
<signal name="activate" handler="remove_torrent"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image8">
<widget class="GtkImage" id="menu-item-image9">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-goto-bottom</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Tracker Options</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkImageMenuItem" id="menuitem5">
<property name="visible">True</property>
<property name="label" translatable="yes">_Update Tracker</property>
<property name="use_underline">True</property>
<signal name="activate" handler="update_tracker"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem13">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Edit Trackers</property>
<property name="use_underline">True</property>
<signal name="activate" handler="edit_trackers"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image12">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Scrape Tracker</property>
<property name="use_underline">True</property>
<signal name="activate" handler="scrape_tracker"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image16">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-info</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Queue</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkImageMenuItem" id="menu_queue_top">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Top</property>
<property name="use_underline">True</property>
<signal name="activate" handler="queue_top"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image10">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-goto-top</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menu_queue_up">
<property name="visible">True</property>
<property name="label" translatable="yes">_Up</property>
<property name="use_underline">True</property>
<signal name="activate" handler="queue_up"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image6">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-go-up</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menu_queue_down">
<property name="visible">True</property>
<property name="label" translatable="yes">_Down</property>
<property name="use_underline">True</property>
<signal name="activate" handler="queue_down"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-go-down</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menu_queue_bottom">
<property name="visible">True</property>
<property name="label" translatable="yes">_Bottom</property>
<property name="use_underline">True</property>
<signal name="activate" handler="queue_bottom"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image8">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-goto-bottom</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image11">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-sort-ascending</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Open Containing Folder</property>
<property name="use_underline">True</property>
<signal name="activate" handler="open_folder_clicked"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image15">
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
</widget>
</child>

136
glade/tray_menu.glade Normal file
View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
<widget class="GtkMenu" id="tray_menu">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkCheckMenuItem" id="show_hide_window">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Show Deluge</property>
<property name="use_underline">True</property>
<signal name="activate" handler="show_hide_window_toggled"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Resume All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="resume_all"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-media-play</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Pause All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="pause_all"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image6">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-media-pause</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="add_torrent">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Add Torrent</property>
<property name="use_underline">True</property>
<signal name="activate" handler="add_torrent"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separatormenuitem3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="download_limit">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Download Speed Limit</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="download-limit-image">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-missing-image</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="upload_limit">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Upload Speed Limit</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="upload-limit-image">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-missing-image</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separatormenuitem4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="quit">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Quit</property>
<property name="use_underline">True</property>
<signal name="activate" handler="quit"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface>

520
glade/wizard.glade Normal file
View File

@ -0,0 +1,520 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.2 on Tue Oct 9 20:54:45 2007 by markybob@peg-->
<glade-interface>
<widget class="GtkAssistant" id="wizard">
<property name="width_request">500</property>
<property name="height_request">335</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">2</property>
<property name="title" translatable="yes">First Launch Configuration</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<signal name="close" handler="close"/>
<signal name="cancel" handler="cancel"/>
<signal name="apply" handler="apply_prefs"/>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">This wizard will help you set up Deluge to your liking. If you are new to Deluge, please note that most of Deluge's functionality and features come in the form of plugins, which can be accessed by clicking on Plugins in the Edit menu or the toolbar.</property>
<property name="wrap">True</property>
</widget>
<packing>
<property name="page_type">GTK_ASSISTANT_PAGE_INTRO</property>
<property name="title">Deluge Configuration</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Deluge needs a range of ports that it will try to listen to for incoming connections. The default ports for bittorrent are 6881-6889, however, most ISPs block those ports, so you're encouraged to pick others, between 49152 and 65535. Alternatively, you can have Deluge automatically pick random ports for you.</property>
<property name="wrap">True</property>
</widget>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">From:</property>
</widget>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_min">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">0 0 65535 1 10 10</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">To:</property>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_port_max">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">0 0 65535 1 10 10</property>
</widget>
<packing>
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_random_ports">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Use _Random Ports</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggle"/>
</widget>
<packing>
<property name="position">4</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="title">Deluge Configuration</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Would you like Deluge to automatically download to a predefined location, or would you like to specify the download location every time?</property>
<property name="wrap">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">28</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radio_ask_save">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Ask where to save each file</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkRadioButton" id="radio_save_all_to">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Store all downloads in: </property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio_ask_save</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkFileChooserButton" id="download_path_button">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
<property name="title" translatable="yes">Select A Folder</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="title">Deluge Configuration</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Please select the upload speed of your connection, which we will then use to automatically make suggestions for the settings below</property>
<property name="wrap">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The number of active torrents that Deluge will run. Set to -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Active Torrents:</property>
</widget>
</child>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum upload slots for all torrents. Set -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Upload Slots:</property>
</widget>
</child>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Upload Speed (KiB/s):</property>
</widget>
</child>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment9">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Connections:</property>
</widget>
</child>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkSpinButton" id="spin_max_upload_slots_global">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum upload slots for all torrents. Set -1 for unlimited.</property>
<property name="adjustment">0 -1 9000 1 10 10</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkSpinButton" id="spin_max_upload">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="adjustment">0 -1 9000 1 10 10</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment10">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkSpinButton" id="spin_max_connections_global">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="adjustment">0 -1 9000 1 10 10</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment12">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkComboBox" id="combo_upload_line">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">28.8k
56k
64k
96k
128k
192k
256k
384k
512k
640k
768k
1Mbit
2Mbit
10Mbit
20Mbit
40Mbit
50Mbit
100Mbit</property>
<signal name="changed" handler="toggle"/>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your Upload Line Speed:</property>
</widget>
<packing>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment13">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum half-open connections. A high value may crash some cheap routers. Set -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Half-Open Connections:</property>
</widget>
</child>
</widget>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment15">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkSpinButton" id="spin_max_half_open">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The maximum half-open connections. A high value may crash some cheap routers. Set -1 for unlimited.</property>
<property name="adjustment">8 -1 9000 1 10 10</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment16">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkSpinButton" id="spin_torrents">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">The number of active torrents that Deluge will run. Set to -1 for unlimited.</property>
<property name="adjustment">0 -1 9000 1 10 10</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="title">Deluge Configuration</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_send_info">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Help us improve Deluge by sending us your Python and PyGTK
versions, OS and processor types. Absolutely no other
information is sent.</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="page_type">GTK_ASSISTANT_PAGE_CONFIRM</property>
<property name="title">Deluge Configuration</property>
</packing>
</child>
</widget>
</glade-interface>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,402 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg3440"
sodipodi:version="0.32"
inkscape:version="0.45"
sodipodi:docbase="/home/zach/deluge/trunk"
sodipodi:docname="deluge.svg"
inkscape:export-filename="/home/zach/deluge.png"
inkscape:export-xdpi="480"
inkscape:export-ydpi="480"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="TRUE">
<defs
id="defs3">
<linearGradient
inkscape:collect="always"
id="linearGradient2973">
<stop
style="stop-color:#eeeeec;stop-opacity:1;"
offset="0"
id="stop2975" />
<stop
style="stop-color:#eeeeec;stop-opacity:0;"
offset="1"
id="stop2977" />
</linearGradient>
<linearGradient
id="linearGradient4126">
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop4128" />
<stop
style="stop-color:#ffffff;stop-opacity:0.16494845;"
offset="1.0000000"
id="stop4130" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient4114">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop4116" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop4118" />
</linearGradient>
<linearGradient
id="linearGradient3962">
<stop
style="stop-color:#d3e9ff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop3964" />
<stop
style="stop-color:#d3e9ff;stop-opacity:1.0000000;"
offset="0.15517241"
id="stop4134" />
<stop
style="stop-color:#4074ae;stop-opacity:1.0000000;"
offset="0.75000000"
id="stop4346" />
<stop
style="stop-color:#36486c;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop3966" />
</linearGradient>
<radialGradient
r="13.994944"
fy="33.506763"
fx="-10.089286"
cy="33.506763"
cx="-10.089286"
gradientTransform="matrix(1,0,0,0.791446,-14.01786,-11.28667)"
gradientUnits="userSpaceOnUse"
id="radialGradient4019"
xlink:href="#linearGradient3993"
inkscape:collect="always" />
<radialGradient
r="14.057444"
fy="31.329016"
fx="-10.323107"
cy="31.329016"
cx="-10.323107"
gradientTransform="matrix(1,0,0,0.792374,-19.58761,2.818569)"
gradientUnits="userSpaceOnUse"
id="radialGradient4004"
xlink:href="#linearGradient3993"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.792374,0,6.785475)"
r="14.057444"
fy="31.329016"
fx="-10.323107"
cy="31.329016"
cx="-10.323107"
id="radialGradient3999"
xlink:href="#linearGradient3993"
inkscape:collect="always" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.341185,-0.153831,1.08001,2.395374,-15.42222,-25.62103)"
r="13.994946"
fy="24.241488"
fx="61.662098"
cy="24.241488"
cx="61.662098"
id="radialGradient3943"
xlink:href="#linearGradient1312"
inkscape:collect="always" />
<linearGradient
id="linearGradient1312">
<stop
id="stop1314"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop1316"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient3993">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3995" />
<stop
style="stop-color:#000000;stop-opacity:0"
offset="1"
id="stop3997" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2973"
id="radialGradient3866"
cx="-22.375"
cy="18.499998"
fx="-22.375"
fy="18.499998"
r="14.33462"
gradientTransform="matrix(1,0,0,1.140022,40.17678,1.347091)"
gradientUnits="userSpaceOnUse" />
<radialGradient
gradientUnits="userSpaceOnUse"
r="12.289036"
fy="63.965388"
fx="15.115514"
cy="63.965388"
cx="15.115514"
gradientTransform="scale(1.643990,0.608276)"
id="radialGradient5000"
xlink:href="#linearGradient4114"
inkscape:collect="always" />
<linearGradient
id="linearGradient4989">
<stop
id="stop4991"
offset="0.0000000"
style="stop-color:#d3e9ff;stop-opacity:1.0000000;" />
<stop
id="stop4993"
offset="0.15517241"
style="stop-color:#d3e9ff;stop-opacity:1.0000000;" />
<stop
id="stop4995"
offset="0.75000000"
style="stop-color:#4074ae;stop-opacity:1.0000000;" />
<stop
id="stop4997"
offset="1.0000000"
style="stop-color:#36486c;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient4977">
<stop
id="stop4979"
offset="0.0000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
<stop
id="stop4981"
offset="1.0000000"
style="stop-color:#ffffff;stop-opacity:0.16494845;" />
</linearGradient>
<linearGradient
id="linearGradient4825"
inkscape:collect="always">
<stop
id="stop4827"
offset="0"
style="stop-color:#ffffff;stop-opacity:1;" />
<stop
id="stop4829"
offset="1"
style="stop-color:#ffffff;stop-opacity:0;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4114"
id="radialGradient6090"
gradientUnits="userSpaceOnUse"
gradientTransform="scale(1.64399,0.608276)"
cx="15.115514"
cy="63.965388"
fx="15.115514"
fy="63.965388"
r="12.289036" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4825"
id="radialGradient6098"
gradientUnits="userSpaceOnUse"
cx="12.071323"
cy="12.493138"
fx="12.071323"
fy="12.493138"
r="6.7175145" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2973"
id="radialGradient6103"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.25463,-0.898371,0.979785,0.277703,-18.00903,32.03312)"
cx="17.903898"
cy="40.159222"
fx="17.903898"
fy="40.159222"
r="14.33681" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2973"
id="radialGradient6106"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.583269,-0.431533,0.577146,0.78008,-5.80022,4.004109)"
cx="12.525543"
cy="38.09042"
fx="12.525543"
fy="38.09042"
r="14.33681" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient1312"
id="radialGradient6109"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.768231,1.13675,-0.820972,0.554824,-3.72248,-85.07126)"
cx="65.800331"
cy="27.16758"
fx="65.800331"
fy="27.16758"
r="12.972491" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4989"
id="radialGradient6115"
cx="16.651781"
cy="32.187485"
fx="16.651781"
fy="32.187485"
r="17.089519"
gradientTransform="matrix(1.486175,-1.536108,0.932321,0.902016,-38.10476,31.42646)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.17254902"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="8"
inkscape:cx="36.250498"
inkscape:cy="38.275489"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1266"
inkscape:window-height="944"
inkscape:window-x="124"
inkscape:window-y="52"
inkscape:showpageshadow="false" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Internet Category</dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:creator>
<dc:contributor>
<cc:Agent>
<dc:title>Tuomas Kuosmanen</dc:title>
</cc:Agent>
</dc:contributor>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
<dc:source>http://jimmac.musichall.cz</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>internet</rdf:li>
<rdf:li>tools</rdf:li>
<rdf:li>applications</rdf:li>
<rdf:li>category</rdf:li>
</rdf:Bag>
</dc:subject>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
style="fill:url(#radialGradient6090);fill-opacity:1;stroke:none;stroke-opacity:1"
id="path4112"
sodipodi:cx="24.849752"
sodipodi:cy="38.908627"
sodipodi:rx="20.203051"
sodipodi:ry="7.4751287"
d="M 45.052803 38.908627 A 20.203051 7.4751287 0 1 1 4.6467018,38.908627 A 20.203051 7.4751287 0 1 1 45.052803 38.908627 z"
transform="matrix(0.947409,0,0,1.17786,1.244375,-6.853427)"
inkscape:export-xdpi="480"
inkscape:export-ydpi="480" />
<path
style="fill:url(#radialGradient6115);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 23.942923,0.9561338 L 37.330543,18.266721 C 46.998995,29.84687 41.49692,43.923891 26.7742,45.000491 C 6.0597413,45.582655 6.5086231,27.37483 11.255313,18.609381 L 23.942923,0.9561338 z "
id="path2069"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#1b4075;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 35.111358,26.143133 C 28.972772,13.030586 17.560684,17.697957 17.274449,26.949974 C 16.894738,39.223415 34.748874,37.615429 36.715244,41.468778 C 28.821643,47.675479 14.973233,45.226508 10.962289,39.715204 C 6.9574776,34.212326 7.2383598,25.630263 10.784249,19.587632 C 24.158625,0.978654 39.749127,24.383766 35.111358,26.143133 z "
id="path2969"
sodipodi:nodetypes="cscscc" />
<path
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.1000706;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.36612022"
d="M 23.996861,3.5433428 L 36.057351,19.151045 C 44.769741,29.58253 39.419346,42.414092 26.125181,43.508521 C 7.3917365,44.015286 7.4275065,28.119221 12.17284,20.333442 L 23.996861,3.5433428 z "
id="path2071"
sodipodi:nodetypes="ccccc" />
<path
style="opacity:0.46;fill:url(#radialGradient6109);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 23.940758,0.96491709 L 34.727367,14.909752 C 42.647208,24.392311 40.447304,20.283975 28.362481,21.278846 C 25.083165,11.203805 18.13871,11.859899 13.523802,15.675236 L 23.940758,0.96491709 z "
id="path3945"
sodipodi:nodetypes="ccccc" />
<path
style="fill:url(#radialGradient6106);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 35.159701,26.173667 C 29.021115,13.06112 18.734027,17.978491 18.447792,27.230508 C 18.068081,39.503949 34.797217,37.645963 36.763587,41.499312 C 28.869986,47.706013 15.021576,45.257042 11.010632,39.745738 C 7.0058197,34.24286 7.2867027,25.660797 10.832592,19.618166 C 24.206968,1.0091879 39.79747,24.4143 35.159701,26.173667 z "
id="path3868"
sodipodi:nodetypes="cscscc" />
<path
style="fill:url(#radialGradient6103);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.07523891px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 35.120795,26.14195 C 28.553327,12.814962 15.685968,17.224233 15.399733,26.47625 C 15.020022,38.749691 32.874158,37.141705 34.840528,40.995054 C 26.946927,47.201755 13.098517,44.752784 9.0875727,39.24148 C 5.0827617,33.738602 5.3636437,25.156539 8.9095327,19.113908 C 22.315509,0.47615954 40.03233,23.660113 35.120795,26.14195 z "
id="path4874"
sodipodi:nodetypes="cscscc" />
<path
transform="matrix(-0.829136,1.052307,1.239307,7.58326e-2,26.32898,25.58605)"
inkscape:r_cy="true"
inkscape:r_cx="true"
d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
sodipodi:ry="6.7175145"
sodipodi:rx="6.7175145"
sodipodi:cy="12.493138"
sodipodi:cx="12.071323"
id="path4941"
style="opacity:0.21999996;color:black;fill:url(#radialGradient6098);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
sodipodi:type="arc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

25
libtorrent/AUTHORS Normal file
View File

@ -0,0 +1,25 @@
Written by Arvid Norberg. Copyright (c) 2003-2007
Lots of testing, suggestions and contributions by:
Massaroddel
Tianhao Qiu.
Contributions by:
Shyam
Magnus Jonsson
Daniel Wallin
Cory Nelson
Stas Khirman
Ryan Norton
Building and maintainance of the autotools scripts:
Michael Wojciechowski
Peter Koeleman
Thanks to Reimond Retz for bugfixes, suggestions and testing
Thanks to University of Ume<6D> for providing development and test hardware.
Project is hosted by sourceforge.

28
libtorrent/COPYING Normal file
View File

@ -0,0 +1,28 @@
Copyright (c) 2003 - 2007, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Rasterbar Software nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.

66
libtorrent/include/libtorrent/alert.hpp Normal file → Executable file
View File

@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <memory>
#include <queue>
#include <string>
#include <cassert>
#include <typeinfo>
#ifdef _MSC_VER
@ -44,20 +43,24 @@ POSSIBILITY OF SUCH DAMAGE.
#endif
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/time.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
#define TORRENT_MAX_ALERT_TYPES 10
#ifndef TORRENT_MAX_ALERT_TYPES
#define TORRENT_MAX_ALERT_TYPES 15
#endif
namespace libtorrent {
@ -70,9 +73,9 @@ namespace libtorrent {
virtual ~alert();
// a timestamp is automatically created in the constructor
boost::posix_time::ptime timestamp() const;
ptime timestamp() const;
const std::string& msg() const;
std::string const& msg() const;
severity_t severity() const;
@ -81,7 +84,7 @@ namespace libtorrent {
private:
std::string m_msg;
severity_t m_severity;
boost::posix_time::ptime m_timestamp;
ptime m_timestamp;
};
class TORRENT_EXPORT alert_manager
@ -97,10 +100,13 @@ namespace libtorrent {
void set_severity(alert::severity_t severity);
bool should_post(alert::severity_t severity) const;
alert const* wait_for_alert(time_duration max_wait);
private:
std::queue<alert*> m_alerts;
alert::severity_t m_severity;
mutable boost::mutex m_mutex;
boost::condition m_condition;
};
struct TORRENT_EXPORT unhandled_alert : std::exception
@ -112,57 +118,45 @@ namespace libtorrent {
struct void_;
template<
class Handler
, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, class T)
>
template<class Handler
, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, class T)>
void handle_alert_dispatch(
const std::auto_ptr<alert>& alert_
, const Handler& handler
, const std::type_info& typeid_
, BOOST_PP_ENUM_BINARY_PARAMS(TORRENT_MAX_ALERT_TYPES, T, *p))
const std::auto_ptr<alert>& alert_, const Handler& handler
, const std::type_info& typeid_
, BOOST_PP_ENUM_BINARY_PARAMS(TORRENT_MAX_ALERT_TYPES, T, *p))
{
if (typeid_ == typeid(T0))
handler(*static_cast<T0*>(alert_.get()));
else
handle_alert_dispatch(
alert_
, handler
, typeid_
, BOOST_PP_ENUM_SHIFTED_PARAMS(TORRENT_MAX_ALERT_TYPES, p), (void_*)0
);
handle_alert_dispatch(alert_, handler, typeid_
, BOOST_PP_ENUM_SHIFTED_PARAMS(
TORRENT_MAX_ALERT_TYPES, p), (void_*)0);
}
template<class Handler>
void handle_alert_dispatch(
const std::auto_ptr<alert>& alert_
, const Handler& handler
, const std::type_info& typeid_
, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, void_* BOOST_PP_INTERCEPT))
const std::auto_ptr<alert>& alert_
, const Handler& handler
, const std::type_info& typeid_
, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, void_* BOOST_PP_INTERCEPT))
{
throw unhandled_alert();
}
} // namespace detail
template<
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TORRENT_MAX_ALERT_TYPES, class T, detail::void_)
>
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
TORRENT_MAX_ALERT_TYPES, class T, detail::void_)>
struct TORRENT_EXPORT handle_alert
{
template<class Handler>
handle_alert(
const std::auto_ptr<alert>& alert_
, const Handler& handler)
handle_alert(const std::auto_ptr<alert>& alert_
, const Handler& handler)
{
#define ALERT_POINTER_TYPE(z, n, text) (BOOST_PP_CAT(T, n)*)0
detail::handle_alert_dispatch(
alert_
, handler
, typeid(*alert_)
, BOOST_PP_ENUM(TORRENT_MAX_ALERT_TYPES, ALERT_POINTER_TYPE, _)
);
detail::handle_alert_dispatch(alert_, handler, typeid(*alert_)
, BOOST_PP_ENUM(TORRENT_MAX_ALERT_TYPES, ALERT_POINTER_TYPE, _));
#undef ALERT_POINTER_TYPE
}

309
libtorrent/include/libtorrent/alert_types.hpp Normal file → Executable file
View File

@ -38,17 +38,28 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket.hpp"
#include "libtorrent/peer_connection.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
namespace libtorrent
{
struct TORRENT_EXPORT tracker_alert: alert
struct TORRENT_EXPORT torrent_alert: alert
{
torrent_alert(torrent_handle const& h, alert::severity_t s
, std::string const& msg)
: alert(s, msg)
, handle(h)
{}
torrent_handle handle;
};
struct TORRENT_EXPORT tracker_alert: torrent_alert
{
tracker_alert(torrent_handle const& h
, int times
, int status
, std::string const& msg)
: alert(alert::warning, msg)
, handle(h)
: torrent_alert(h, alert::warning, msg)
, times_in_row(times)
, status_code(status)
{}
@ -56,85 +67,102 @@ namespace libtorrent
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_alert(*this)); }
torrent_handle handle;
int times_in_row;
int status_code;
};
struct TORRENT_EXPORT tracker_warning_alert: alert
struct TORRENT_EXPORT tracker_warning_alert: torrent_alert
{
tracker_warning_alert(torrent_handle const& h
, std::string const& msg)
: alert(alert::warning, msg)
, handle(h)
: torrent_alert(h, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_warning_alert(*this)); }
torrent_handle handle;
};
struct TORRENT_EXPORT tracker_reply_alert: alert
struct TORRENT_EXPORT scrape_reply_alert: torrent_alert
{
tracker_reply_alert(torrent_handle const& h
scrape_reply_alert(torrent_handle const& h
, int incomplete_
, int complete_
, std::string const& msg)
: alert(alert::info, msg)
, handle(h)
: torrent_alert(h, alert::info, msg)
, incomplete(incomplete_)
, complete(complete_)
{}
int incomplete;
int complete;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new scrape_reply_alert(*this)); }
};
struct TORRENT_EXPORT scrape_failed_alert: torrent_alert
{
scrape_failed_alert(torrent_handle const& h
, std::string const& msg)
: torrent_alert(h, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_reply_alert(*this)); }
torrent_handle handle;
{ return std::auto_ptr<alert>(new scrape_failed_alert(*this)); }
};
struct TORRENT_EXPORT tracker_announce_alert: alert
struct TORRENT_EXPORT tracker_reply_alert: torrent_alert
{
tracker_reply_alert(torrent_handle const& h
, int np
, std::string const& msg)
: torrent_alert(h, alert::info, msg)
, num_peers(np)
{}
int num_peers;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_reply_alert(*this)); }
};
struct TORRENT_EXPORT tracker_announce_alert: torrent_alert
{
tracker_announce_alert(torrent_handle const& h, std::string const& msg)
: alert(alert::info, msg)
, handle(h)
: torrent_alert(h, alert::info, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_announce_alert(*this)); }
torrent_handle handle;
};
struct TORRENT_EXPORT hash_failed_alert: alert
struct TORRENT_EXPORT hash_failed_alert: torrent_alert
{
hash_failed_alert(
torrent_handle const& h
, int index
, std::string const& msg)
: alert(alert::info, msg)
, handle(h)
: torrent_alert(h, alert::info, msg)
, piece_index(index)
{ assert(index >= 0);}
{ TORRENT_ASSERT(index >= 0);}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new hash_failed_alert(*this)); }
torrent_handle handle;
int piece_index;
};
struct TORRENT_EXPORT peer_ban_alert: alert
struct TORRENT_EXPORT peer_ban_alert: torrent_alert
{
peer_ban_alert(tcp::endpoint const& pip, torrent_handle h, std::string const& msg)
: alert(alert::info, msg)
: torrent_alert(h, alert::info, msg)
, ip(pip)
, handle(h)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new peer_ban_alert(*this)); }
tcp::endpoint ip;
torrent_handle handle;
};
struct TORRENT_EXPORT peer_error_alert: alert
@ -152,25 +180,7 @@ namespace libtorrent
peer_id pid;
};
struct TORRENT_EXPORT chat_message_alert: alert
{
chat_message_alert(
const torrent_handle& h
, const tcp::endpoint& sender
, const std::string& msg)
: alert(alert::critical, msg)
, handle(h)
, ip(sender)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new chat_message_alert(*this)); }
torrent_handle handle;
tcp::endpoint ip;
};
struct TORRENT_EXPORT invalid_request_alert: alert
struct TORRENT_EXPORT invalid_request_alert: torrent_alert
{
invalid_request_alert(
peer_request const& r
@ -178,8 +188,7 @@ namespace libtorrent
, tcp::endpoint const& sender
, peer_id const& pid_
, std::string const& msg)
: alert(alert::debug, msg)
, handle(h)
: torrent_alert(h, alert::debug, msg)
, ip(sender)
, request(r)
, pid(pid_)
@ -188,33 +197,128 @@ namespace libtorrent
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new invalid_request_alert(*this)); }
torrent_handle handle;
tcp::endpoint ip;
peer_request request;
peer_id pid;
};
struct TORRENT_EXPORT torrent_finished_alert: alert
struct TORRENT_EXPORT torrent_finished_alert: torrent_alert
{
torrent_finished_alert(
const torrent_handle& h
, const std::string& msg)
: alert(alert::warning, msg)
, handle(h)
: torrent_alert(h, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new torrent_finished_alert(*this)); }
torrent_handle handle;
};
struct TORRENT_EXPORT url_seed_alert: alert
struct TORRENT_EXPORT piece_finished_alert: torrent_alert
{
piece_finished_alert(
const torrent_handle& h
, int piece_num
, const std::string& msg)
: torrent_alert(h, alert::debug, msg)
, piece_index(piece_num)
{ TORRENT_ASSERT(piece_index >= 0);}
int piece_index;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new piece_finished_alert(*this)); }
};
struct TORRENT_EXPORT block_finished_alert: torrent_alert
{
block_finished_alert(
const torrent_handle& h
, int block_num
, int piece_num
, const std::string& msg)
: torrent_alert(h, alert::debug, msg)
, block_index(block_num)
, piece_index(piece_num)
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
int block_index;
int piece_index;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new block_finished_alert(*this)); }
};
struct TORRENT_EXPORT block_downloading_alert: torrent_alert
{
block_downloading_alert(
const torrent_handle& h
, char const* speedmsg
, int block_num
, int piece_num
, const std::string& msg)
: torrent_alert(h, alert::debug, msg)
, peer_speedmsg(speedmsg)
, block_index(block_num)
, piece_index(piece_num)
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
std::string peer_speedmsg;
int block_index;
int piece_index;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new block_downloading_alert(*this)); }
};
struct TORRENT_EXPORT storage_moved_alert: torrent_alert
{
storage_moved_alert(torrent_handle const& h, std::string const& path)
: torrent_alert(h, alert::warning, path)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new storage_moved_alert(*this)); }
};
struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert
{
torrent_deleted_alert(torrent_handle const& h, std::string const& msg)
: torrent_alert(h, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new torrent_deleted_alert(*this)); }
};
struct TORRENT_EXPORT torrent_paused_alert: torrent_alert
{
torrent_paused_alert(torrent_handle const& h, std::string const& msg)
: torrent_alert(h, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new torrent_paused_alert(*this)); }
};
struct TORRENT_EXPORT torrent_checked_alert: torrent_alert
{
torrent_checked_alert(torrent_handle const& h, std::string const& msg)
: torrent_alert(h, alert::info, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new torrent_checked_alert(*this)); }
};
struct TORRENT_EXPORT url_seed_alert: torrent_alert
{
url_seed_alert(
const std::string& url_
torrent_handle const& h
, const std::string& url_
, const std::string& msg)
: alert(alert::warning, msg)
: torrent_alert(h, alert::warning, msg)
, url(url_)
{}
@ -224,74 +328,115 @@ namespace libtorrent
std::string url;
};
struct TORRENT_EXPORT file_error_alert: alert
struct TORRENT_EXPORT file_error_alert: torrent_alert
{
file_error_alert(
const torrent_handle& h
, const std::string& msg)
: alert(alert::fatal, msg)
, handle(h)
: torrent_alert(h, alert::fatal, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new file_error_alert(*this)); }
torrent_handle handle;
};
struct TORRENT_EXPORT metadata_failed_alert: alert
struct TORRENT_EXPORT metadata_failed_alert: torrent_alert
{
metadata_failed_alert(
const torrent_handle& h
, const std::string& msg)
: alert(alert::info, msg)
, handle(h)
: torrent_alert(h, alert::info, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new metadata_failed_alert(*this)); }
torrent_handle handle;
};
struct TORRENT_EXPORT metadata_received_alert: alert
struct TORRENT_EXPORT metadata_received_alert: torrent_alert
{
metadata_received_alert(
const torrent_handle& h
, const std::string& msg)
: alert(alert::info, msg)
, handle(h)
: torrent_alert(h, alert::info, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new metadata_received_alert(*this)); }
torrent_handle handle;
};
struct TORRENT_EXPORT listen_failed_alert: alert
{
listen_failed_alert(
const std::string& msg)
tcp::endpoint const& ep
, std::string const& msg)
: alert(alert::fatal, msg)
, endpoint(ep)
{}
tcp::endpoint endpoint;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new listen_failed_alert(*this)); }
};
struct TORRENT_EXPORT fastresume_rejected_alert: alert
struct TORRENT_EXPORT listen_succeeded_alert: alert
{
listen_succeeded_alert(
tcp::endpoint const& ep
, std::string const& msg)
: alert(alert::fatal, msg)
, endpoint(ep)
{}
tcp::endpoint endpoint;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new listen_succeeded_alert(*this)); }
};
struct TORRENT_EXPORT portmap_error_alert: alert
{
portmap_error_alert(const std::string& msg)
: alert(alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new portmap_error_alert(*this)); }
};
struct TORRENT_EXPORT portmap_alert: alert
{
portmap_alert(const std::string& msg)
: alert(alert::info, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new portmap_alert(*this)); }
};
struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert
{
fastresume_rejected_alert(torrent_handle const& h
, std::string const& msg)
: alert(alert::warning, msg)
, handle(h)
: torrent_alert(h, alert::warning, msg)
{}
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new fastresume_rejected_alert(*this)); }
};
torrent_handle handle;
struct TORRENT_EXPORT peer_blocked_alert: alert
{
peer_blocked_alert(address const& ip_
, std::string const& msg)
: alert(alert::info, msg)
, ip(ip_)
{}
address ip;
virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new peer_blocked_alert(*this)); }
};
}

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/resource_request.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/session.hpp"
namespace libtorrent
{
@ -66,6 +67,11 @@ namespace libtorrent
, std::map<tcp::endpoint, peer_connection*>& connections
, resource_request peer_connection::* res);
// Used for global limits.
void allocate_resources(
int resources
, std::vector<session*>& _sessions
, resource_request session::* res);
}

View File

@ -1,71 +0,0 @@
//
// asio.hpp
// ~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_HPP
#define ASIO_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/basic_datagram_socket.hpp"
#include "asio/basic_deadline_timer.hpp"
#include "asio/basic_io_object.hpp"
#include "asio/basic_resolver.hpp"
#include "asio/basic_socket_acceptor.hpp"
#include "asio/basic_socket_iostream.hpp"
#include "asio/basic_socket_streambuf.hpp"
#include "asio/basic_stream_socket.hpp"
#include "asio/basic_streambuf.hpp"
#include "asio/buffer.hpp"
#include "asio/buffered_read_stream_fwd.hpp"
#include "asio/buffered_read_stream.hpp"
#include "asio/buffered_stream_fwd.hpp"
#include "asio/buffered_stream.hpp"
#include "asio/buffered_write_stream_fwd.hpp"
#include "asio/buffered_write_stream.hpp"
#include "asio/completion_condition.hpp"
#include "asio/datagram_socket_service.hpp"
#include "asio/deadline_timer_service.hpp"
#include "asio/deadline_timer.hpp"
#include "asio/error_handler.hpp"
#include "asio/error.hpp"
#include "asio/handler_alloc_hook.hpp"
#include "asio/handler_invoke_hook.hpp"
#include "asio/io_service.hpp"
#include "asio/ip/address.hpp"
#include "asio/ip/address_v4.hpp"
#include "asio/ip/address_v6.hpp"
#include "asio/ip/basic_endpoint.hpp"
#include "asio/ip/basic_resolver_entry.hpp"
#include "asio/ip/basic_resolver_iterator.hpp"
#include "asio/ip/basic_resolver_query.hpp"
#include "asio/ip/host_name.hpp"
#include "asio/ip/multicast.hpp"
#include "asio/ip/resolver_query_base.hpp"
#include "asio/ip/tcp.hpp"
#include "asio/ip/udp.hpp"
#include "asio/is_read_buffered.hpp"
#include "asio/is_write_buffered.hpp"
#include "asio/placeholders.hpp"
#include "asio/read.hpp"
#include "asio/read_until.hpp"
#include "asio/resolver_service.hpp"
#include "asio/socket_acceptor_service.hpp"
#include "asio/socket_base.hpp"
#include "asio/strand.hpp"
#include "asio/stream_socket_service.hpp"
#include "asio/streambuf.hpp"
#include "asio/system_exception.hpp"
#include "asio/thread.hpp"
#include "asio/time_traits.hpp"
#include "asio/write.hpp"
#endif // ASIO_HPP

View File

@ -0,0 +1,4 @@
Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@ -2,7 +2,7 @@
// basic_datagram_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -24,7 +24,8 @@
#include "asio/basic_socket.hpp"
#include "asio/datagram_socket_service.hpp"
#include "asio/error_handler.hpp"
#include "asio/error.hpp"
#include "asio/detail/throw_error.hpp"
namespace asio {
@ -33,21 +34,18 @@ namespace asio {
* The basic_datagram_socket class template provides asynchronous and blocking
* datagram-oriented socket functionality.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Async_Object, Error_Source.
*/
template <typename Protocol,
typename Service = datagram_socket_service<Protocol> >
typename DatagramSocketService = datagram_socket_service<Protocol> >
class basic_datagram_socket
: public basic_socket<Protocol, Service>
: public basic_socket<Protocol, DatagramSocketService>
{
public:
/// The native representation of a socket.
typedef typename Service::native_type native_type;
typedef typename DatagramSocketService::native_type native_type;
/// The protocol type.
typedef Protocol protocol_type;
@ -65,7 +63,7 @@ public:
* socket.
*/
explicit basic_datagram_socket(asio::io_service& io_service)
: basic_socket<Protocol, Service>(io_service)
: basic_socket<Protocol, DatagramSocketService>(io_service)
{
}
@ -79,11 +77,11 @@ public:
*
* @param protocol An object specifying protocol parameters to be used.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_datagram_socket(asio::io_service& io_service,
const protocol_type& protocol)
: basic_socket<Protocol, Service>(io_service, protocol)
: basic_socket<Protocol, DatagramSocketService>(io_service, protocol)
{
}
@ -101,11 +99,11 @@ public:
* @param endpoint An endpoint on the local machine to which the datagram
* socket will be bound.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_datagram_socket(asio::io_service& io_service,
const endpoint_type& endpoint)
: basic_socket<Protocol, Service>(io_service, endpoint)
: basic_socket<Protocol, DatagramSocketService>(io_service, endpoint)
{
}
@ -122,11 +120,12 @@ public:
*
* @param native_socket The new underlying socket implementation.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_datagram_socket(asio::io_service& io_service,
const protocol_type& protocol, const native_type& native_socket)
: basic_socket<Protocol, Service>(io_service, protocol, native_socket)
: basic_socket<Protocol, DatagramSocketService>(
io_service, protocol, native_socket)
{
}
@ -140,22 +139,25 @@ public:
*
* @returns The number of bytes sent.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note The send operation can only be used with a connected socket. Use
* the send_to function to send data on an unconnected datagram socket.
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code socket.send(asio::buffer(data, size)); @endcode
* See the @ref buffer documentation for information on sending multiple
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers>
std::size_t send(const Const_Buffers& buffers)
template <typename ConstBufferSequence>
std::size_t send(const ConstBufferSequence& buffers)
{
return this->service.send(this->implementation, buffers, 0, throw_error());
asio::error_code ec;
std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Send some data on a connected socket.
@ -170,17 +172,20 @@ public:
*
* @returns The number of bytes sent.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note The send operation can only be used with a connected socket. Use
* the send_to function to send data on an unconnected datagram socket.
*/
template <typename Const_Buffers>
std::size_t send(const Const_Buffers& buffers,
template <typename ConstBufferSequence>
std::size_t send(const ConstBufferSequence& buffers,
socket_base::message_flags flags)
{
return this->service.send(this->implementation, buffers, flags,
throw_error());
asio::error_code ec;
std::size_t s = this->service.send(
this->implementation, buffers, flags, ec);
asio::detail::throw_error(ec);
return s;
}
/// Send some data on a connected socket.
@ -193,24 +198,18 @@ public:
*
* @param flags Flags specifying how the send call is to be made.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes sent.
*
* @note The send operation can only be used with a connected socket. Use
* the send_to function to send data on an unconnected datagram socket.
*/
template <typename Const_Buffers, typename Error_Handler>
std::size_t send(const Const_Buffers& buffers,
socket_base::message_flags flags, Error_Handler error_handler)
template <typename ConstBufferSequence>
std::size_t send(const ConstBufferSequence& buffers,
socket_base::message_flags flags, asio::error_code& ec)
{
return this->service.send(this->implementation, buffers, flags,
error_handler);
return this->service.send(this->implementation, buffers, flags, ec);
}
/// Start an asynchronous send on a connected socket.
@ -228,8 +227,8 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -240,7 +239,7 @@ public:
* Use the async_send_to function to send data on an unconnected datagram
* socket.
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code
* socket.async_send(asio::buffer(data, size), handler);
@ -249,8 +248,8 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers, typename Handler>
void async_send(const Const_Buffers& buffers, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
{
this->service.async_send(this->implementation, buffers, 0, handler);
}
@ -272,8 +271,8 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -284,9 +283,9 @@ public:
* Use the async_send_to function to send data on an unconnected datagram
* socket.
*/
template <typename Const_Buffers, typename Handler>
void async_send(const Const_Buffers& buffers,
socket_base::message_flags flags, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_send(const ConstBufferSequence& buffers,
socket_base::message_flags flags, WriteHandler handler)
{
this->service.async_send(this->implementation, buffers, flags, handler);
}
@ -303,9 +302,9 @@ public:
*
* @returns The number of bytes sent.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code
* asio::ip::udp::endpoint destination(
@ -316,12 +315,15 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers>
std::size_t send_to(const Const_Buffers& buffers,
template <typename ConstBufferSequence>
std::size_t send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination)
{
return this->service.send_to(this->implementation, buffers, destination, 0,
throw_error());
asio::error_code ec;
std::size_t s = this->service.send_to(
this->implementation, buffers, destination, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Send a datagram to the specified endpoint.
@ -338,14 +340,17 @@ public:
*
* @returns The number of bytes sent.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
template <typename Const_Buffers>
std::size_t send_to(const Const_Buffers& buffers,
template <typename ConstBufferSequence>
std::size_t send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination, socket_base::message_flags flags)
{
return this->service.send_to(this->implementation, buffers, destination,
flags, throw_error());
asio::error_code ec;
std::size_t s = this->service.send_to(
this->implementation, buffers, destination, flags, ec);
asio::detail::throw_error(ec);
return s;
}
/// Send a datagram to the specified endpoint.
@ -360,22 +365,17 @@ public:
*
* @param flags Flags specifying how the send call is to be made.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes sent.
*/
template <typename Const_Buffers, typename Error_Handler>
std::size_t send_to(const Const_Buffers& buffers,
template <typename ConstBufferSequence>
std::size_t send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination, socket_base::message_flags flags,
Error_Handler error_handler)
asio::error_code& ec)
{
return this->service.send_to(this->implementation, buffers, destination,
flags, error_handler);
return this->service.send_to(this->implementation,
buffers, destination, flags, ec);
}
/// Start an asynchronous send.
@ -395,15 +395,15 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code
* asio::ip::udp::endpoint destination(
@ -415,9 +415,9 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers, typename Handler>
void async_send_to(const Const_Buffers& buffers,
const endpoint_type& destination, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination, WriteHandler handler)
{
this->service.async_send_to(this->implementation, buffers, destination, 0,
handler);
@ -442,18 +442,18 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*/
template <typename Const_Buffers, typename Handler>
void async_send_to(const Const_Buffers& buffers,
template <typename ConstBufferSequence, typename WriteHandler>
void async_send_to(const ConstBufferSequence& buffers,
const endpoint_type& destination, socket_base::message_flags flags,
Handler handler)
WriteHandler handler)
{
this->service.async_send_to(this->implementation, buffers, destination,
flags, handler);
@ -469,13 +469,13 @@ public:
*
* @returns The number of bytes received.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note The receive operation can only be used with a connected socket. Use
* the receive_from function to receive data on an unconnected datagram
* socket.
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code socket.receive(asio::buffer(data, size)); @endcode
@ -483,11 +483,14 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers>
std::size_t receive(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t receive(const MutableBufferSequence& buffers)
{
return this->service.receive(this->implementation, buffers, 0,
throw_error());
asio::error_code ec;
std::size_t s = this->service.receive(
this->implementation, buffers, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Receive some data on a connected socket.
@ -502,18 +505,21 @@ public:
*
* @returns The number of bytes received.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note The receive operation can only be used with a connected socket. Use
* the receive_from function to receive data on an unconnected datagram
* socket.
*/
template <typename Mutable_Buffers>
std::size_t receive(const Mutable_Buffers& buffers,
template <typename MutableBufferSequence>
std::size_t receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags)
{
return this->service.receive(this->implementation, buffers, flags,
throw_error());
asio::error_code ec;
std::size_t s = this->service.receive(
this->implementation, buffers, flags, ec);
asio::detail::throw_error(ec);
return s;
}
/// Receive some data on a connected socket.
@ -526,12 +532,7 @@ public:
*
* @param flags Flags specifying how the receive call is to be made.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes received.
*
@ -539,12 +540,11 @@ public:
* the receive_from function to receive data on an unconnected datagram
* socket.
*/
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t receive(const Mutable_Buffers& buffers,
socket_base::message_flags flags, Error_Handler error_handler)
template <typename MutableBufferSequence>
std::size_t receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags, asio::error_code& ec)
{
return this->service.receive(this->implementation, buffers, flags,
error_handler);
return this->service.receive(this->implementation, buffers, flags, ec);
}
/// Start an asynchronous receive on a connected socket.
@ -561,8 +561,8 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -573,7 +573,7 @@ public:
* Use the async_receive_from function to receive data on an unconnected
* datagram socket.
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code
@ -583,8 +583,8 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers, typename Handler>
void async_receive(const Mutable_Buffers& buffers, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
{
this->service.async_receive(this->implementation, buffers, 0, handler);
}
@ -605,8 +605,8 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -617,9 +617,9 @@ public:
* Use the async_receive_from function to receive data on an unconnected
* datagram socket.
*/
template <typename Mutable_Buffers, typename Handler>
void async_receive(const Mutable_Buffers& buffers,
socket_base::message_flags flags, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags, ReadHandler handler)
{
this->service.async_receive(this->implementation, buffers, flags, handler);
}
@ -636,9 +636,9 @@ public:
*
* @returns The number of bytes received.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code
@ -650,12 +650,15 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers>
std::size_t receive_from(const Mutable_Buffers& buffers,
template <typename MutableBufferSequence>
std::size_t receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint)
{
return this->service.receive_from(this->implementation, buffers,
sender_endpoint, 0, throw_error());
asio::error_code ec;
std::size_t s = this->service.receive_from(
this->implementation, buffers, sender_endpoint, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Receive a datagram with the endpoint of the sender.
@ -672,14 +675,17 @@ public:
*
* @returns The number of bytes received.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
template <typename Mutable_Buffers>
std::size_t receive_from(const Mutable_Buffers& buffers,
template <typename MutableBufferSequence>
std::size_t receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint, socket_base::message_flags flags)
{
return this->service.receive_from(this->implementation, buffers,
sender_endpoint, flags, throw_error());
asio::error_code ec;
std::size_t s = this->service.receive_from(
this->implementation, buffers, sender_endpoint, flags, ec);
asio::detail::throw_error(ec);
return s;
}
/// Receive a datagram with the endpoint of the sender.
@ -694,22 +700,17 @@ public:
*
* @param flags Flags specifying how the receive call is to be made.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes received.
*/
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t receive_from(const Mutable_Buffers& buffers,
template <typename MutableBufferSequence>
std::size_t receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint, socket_base::message_flags flags,
Error_Handler error_handler)
asio::error_code& ec)
{
return this->service.receive_from(this->implementation, buffers,
sender_endpoint, flags, error_handler);
sender_endpoint, flags, ec);
}
/// Start an asynchronous receive.
@ -731,15 +732,15 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code socket.async_receive_from(
@ -748,9 +749,9 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers, typename Handler>
void async_receive_from(const Mutable_Buffers& buffers,
endpoint_type& sender_endpoint, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint, ReadHandler handler)
{
this->service.async_receive_from(this->implementation, buffers,
sender_endpoint, 0, handler);
@ -777,18 +778,18 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*/
template <typename Mutable_Buffers, typename Handler>
void async_receive_from(const Mutable_Buffers& buffers,
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive_from(const MutableBufferSequence& buffers,
endpoint_type& sender_endpoint, socket_base::message_flags flags,
Handler handler)
ReadHandler handler)
{
this->service.async_receive_from(this->implementation, buffers,
sender_endpoint, flags, handler);

View File

@ -2,7 +2,7 @@
// basic_deadline_timer.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -25,6 +25,7 @@
#include "asio/basic_io_object.hpp"
#include "asio/deadline_timer_service.hpp"
#include "asio/error.hpp"
#include "asio/detail/throw_error.hpp"
namespace asio {
@ -35,16 +36,11 @@ namespace asio {
*
* Most applications will use the asio::deadline_timer typedef.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Async_Object, Error_Source.
*
* @sa @ref deadline_timer_reset
*
* @par Examples:
* @par Examples
* Performing a blocking wait:
* @code
* // Construct a timer without setting an expiry time.
@ -60,7 +56,7 @@ namespace asio {
* @par
* Performing an asynchronous wait:
* @code
* void handler(const asio::error& error)
* void handler(const asio::error_code& error)
* {
* if (!error)
* {
@ -77,190 +73,8 @@ namespace asio {
* // Start an asynchronous wait.
* timer.async_wait(handler);
* @endcode
*/
template <typename Time_Type,
typename Time_Traits = asio::time_traits<Time_Type>,
typename Service = deadline_timer_service<Time_Type, Time_Traits> >
class basic_deadline_timer
: public basic_io_object<Service>
{
public:
/// The type used for reporting errors.
typedef asio::error error_type;
/// The time traits type.
typedef Time_Traits traits_type;
/// The time type.
typedef typename traits_type::time_type time_type;
/// The duration type.
typedef typename traits_type::duration_type duration_type;
/// Constructor.
/**
* This constructor creates a timer without setting an expiry time. The
* expires_at() or expires_from_now() functions must be called to set an
* expiry time before the timer can be waited on.
*
* @param io_service The io_service object that the timer will use to dispatch
* handlers for any asynchronous operations performed on the timer.
*/
explicit basic_deadline_timer(asio::io_service& io_service)
: basic_io_object<Service>(io_service)
{
}
/// Constructor to set a particular expiry time as an absolute time.
/**
* This constructor creates a timer and sets the expiry time.
*
* @param io_service The io_service object that the timer will use to dispatch
* handlers for any asynchronous operations performed on the timer.
*
* @param expiry_time The expiry time to be used for the timer, expressed
* as an absolute time.
*/
basic_deadline_timer(asio::io_service& io_service,
const time_type& expiry_time)
: basic_io_object<Service>(io_service)
{
this->service.expires_at(this->implementation, expiry_time);
}
/// Constructor to set a particular expiry time relative to now.
/**
* This constructor creates a timer and sets the expiry time.
*
* @param io_service The io_service object that the timer will use to dispatch
* handlers for any asynchronous operations performed on the timer.
*
* @param expiry_time The expiry time to be used for the timer, relative to
* now.
*/
basic_deadline_timer(asio::io_service& io_service,
const duration_type& expiry_time)
: basic_io_object<Service>(io_service)
{
this->service.expires_from_now(this->implementation, expiry_time);
}
/// Cancel any asynchronous operations that are waiting on the timer.
/**
* This function forces the completion of any pending asynchronous wait
* operations against the timer. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* Cancelling the timer does not change the expiry time.
*
* @return The number of asynchronous operations that were cancelled.
*/
std::size_t cancel()
{
return this->service.cancel(this->implementation);
}
/// Get the timer's expiry time as an absolute time.
/**
* This function may be used to obtain the timer's current expiry time.
* Whether the timer has expired or not does not affect this value.
*/
time_type expires_at() const
{
return this->service.expires_at(this->implementation);
}
/// Set the timer's expiry time as an absolute time.
/**
* This function sets the expiry time. Any pending asynchronous wait
* operations will be cancelled. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* See @ref deadline_timer_reset for more information on altering the expiry
* time of an active timer.
*
* @param expiry_time The expiry time to be used for the timer.
*
* @return The number of asynchronous operations that were cancelled.
*/
std::size_t expires_at(const time_type& expiry_time)
{
return this->service.expires_at(this->implementation, expiry_time);
}
/// Get the timer's expiry time relative to now.
/**
* This function may be used to obtain the timer's current expiry time.
* Whether the timer has expired or not does not affect this value.
*/
duration_type expires_from_now() const
{
return this->service.expires_from_now(this->implementation);
}
/// Set the timer's expiry time relative to now.
/**
* This function sets the expiry time. Any pending asynchronous wait
* operations will be cancelled. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* See @ref deadline_timer_reset for more information on altering the expiry
* time of an active timer.
*
* @param expiry_time The expiry time to be used for the timer.
*
* @return The number of asynchronous operations that were cancelled.
*/
std::size_t expires_from_now(const duration_type& expiry_time)
{
return this->service.expires_from_now(this->implementation, expiry_time);
}
/// Perform a blocking wait on the timer.
/**
* This function is used to wait for the timer to expire. This function
* blocks and does not return until the timer has expired.
*
* @throws asio::error Thrown on failure.
*/
void wait()
{
this->service.wait(this->implementation);
}
/// Start an asynchronous wait on the timer.
/**
* This function may be used to initiate an asynchronous wait against the
* timer. It always returns immediately.
*
* For each call to async_wait(), the supplied handler will be called exactly
* once. The handler will be called when:
*
* @li The timer has expired.
*
* @li The timer was cancelled, in which case the handler is passed the error
* code asio::error::operation_aborted.
*
* @param handler The handler to be called when the timer expires. Copies
* will be made of the handler as required. The function signature of the
* handler must be:
* @code void handler(
* const asio::error& error // Result of operation
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*/
template <typename Handler>
void async_wait(Handler handler)
{
this->service.async_wait(this->implementation, handler);
}
};
/**
* @page deadline_timer_reset Changing an active deadline_timer's expiry time
*
* @par Changing an active deadline_timer's expiry time
*
* Changing the expiry time of a timer while there are pending asynchronous
* waits causes those wait operations to be cancelled. To ensure that the action
@ -281,7 +95,7 @@ public:
* }
* }
*
* void on_timeout(const asio::error& e)
* void on_timeout(const asio::error_code& e)
* {
* if (e != asio::error::operation_aborted)
* {
@ -296,11 +110,269 @@ public:
* late and the wait handler has already been executed, or will soon be
* executed. If it returns 1 then the wait handler was successfully cancelled.
*
* @li If a wait handler is cancelled, the asio::error passed to it
* contains the value asio::error::operation_aborted.
*
* @sa asio::basic_deadline_timer
* @li If a wait handler is cancelled, the asio::error_code passed to
* it contains the value asio::error::operation_aborted.
*/
template <typename Time,
typename TimeTraits = asio::time_traits<Time>,
typename TimerService = deadline_timer_service<Time, TimeTraits> >
class basic_deadline_timer
: public basic_io_object<TimerService>
{
public:
/// The time traits type.
typedef TimeTraits traits_type;
/// The time type.
typedef typename traits_type::time_type time_type;
/// The duration type.
typedef typename traits_type::duration_type duration_type;
/// Constructor.
/**
* This constructor creates a timer without setting an expiry time. The
* expires_at() or expires_from_now() functions must be called to set an
* expiry time before the timer can be waited on.
*
* @param io_service The io_service object that the timer will use to dispatch
* handlers for any asynchronous operations performed on the timer.
*/
explicit basic_deadline_timer(asio::io_service& io_service)
: basic_io_object<TimerService>(io_service)
{
}
/// Constructor to set a particular expiry time as an absolute time.
/**
* This constructor creates a timer and sets the expiry time.
*
* @param io_service The io_service object that the timer will use to dispatch
* handlers for any asynchronous operations performed on the timer.
*
* @param expiry_time The expiry time to be used for the timer, expressed
* as an absolute time.
*/
basic_deadline_timer(asio::io_service& io_service,
const time_type& expiry_time)
: basic_io_object<TimerService>(io_service)
{
asio::error_code ec;
this->service.expires_at(this->implementation, expiry_time, ec);
asio::detail::throw_error(ec);
}
/// Constructor to set a particular expiry time relative to now.
/**
* This constructor creates a timer and sets the expiry time.
*
* @param io_service The io_service object that the timer will use to dispatch
* handlers for any asynchronous operations performed on the timer.
*
* @param expiry_time The expiry time to be used for the timer, relative to
* now.
*/
basic_deadline_timer(asio::io_service& io_service,
const duration_type& expiry_time)
: basic_io_object<TimerService>(io_service)
{
asio::error_code ec;
this->service.expires_from_now(this->implementation, expiry_time, ec);
asio::detail::throw_error(ec);
}
/// Cancel any asynchronous operations that are waiting on the timer.
/**
* This function forces the completion of any pending asynchronous wait
* operations against the timer. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* Cancelling the timer does not change the expiry time.
*
* @return The number of asynchronous operations that were cancelled.
*
* @throws asio::system_error Thrown on failure.
*/
std::size_t cancel()
{
asio::error_code ec;
std::size_t s = this->service.cancel(this->implementation, ec);
asio::detail::throw_error(ec);
return s;
}
/// Cancel any asynchronous operations that are waiting on the timer.
/**
* This function forces the completion of any pending asynchronous wait
* operations against the timer. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* Cancelling the timer does not change the expiry time.
*
* @param ec Set to indicate what error occurred, if any.
*
* @return The number of asynchronous operations that were cancelled.
*/
std::size_t cancel(asio::error_code& ec)
{
return this->service.cancel(this->implementation, ec);
}
/// Get the timer's expiry time as an absolute time.
/**
* This function may be used to obtain the timer's current expiry time.
* Whether the timer has expired or not does not affect this value.
*/
time_type expires_at() const
{
return this->service.expires_at(this->implementation);
}
/// Set the timer's expiry time as an absolute time.
/**
* This function sets the expiry time. Any pending asynchronous wait
* operations will be cancelled. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* @param expiry_time The expiry time to be used for the timer.
*
* @return The number of asynchronous operations that were cancelled.
*
* @throws asio::system_error Thrown on failure.
*/
std::size_t expires_at(const time_type& expiry_time)
{
asio::error_code ec;
std::size_t s = this->service.expires_at(
this->implementation, expiry_time, ec);
asio::detail::throw_error(ec);
return s;
}
/// Set the timer's expiry time as an absolute time.
/**
* This function sets the expiry time. Any pending asynchronous wait
* operations will be cancelled. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* @param expiry_time The expiry time to be used for the timer.
*
* @param ec Set to indicate what error occurred, if any.
*
* @return The number of asynchronous operations that were cancelled.
*/
std::size_t expires_at(const time_type& expiry_time,
asio::error_code& ec)
{
return this->service.expires_at(this->implementation, expiry_time, ec);
}
/// Get the timer's expiry time relative to now.
/**
* This function may be used to obtain the timer's current expiry time.
* Whether the timer has expired or not does not affect this value.
*/
duration_type expires_from_now() const
{
return this->service.expires_from_now(this->implementation);
}
/// Set the timer's expiry time relative to now.
/**
* This function sets the expiry time. Any pending asynchronous wait
* operations will be cancelled. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* @param expiry_time The expiry time to be used for the timer.
*
* @return The number of asynchronous operations that were cancelled.
*
* @throws asio::system_error Thrown on failure.
*/
std::size_t expires_from_now(const duration_type& expiry_time)
{
asio::error_code ec;
std::size_t s = this->service.expires_from_now(
this->implementation, expiry_time, ec);
asio::detail::throw_error(ec);
return s;
}
/// Set the timer's expiry time relative to now.
/**
* This function sets the expiry time. Any pending asynchronous wait
* operations will be cancelled. The handler for each cancelled operation will
* be invoked with the asio::error::operation_aborted error code.
*
* @param expiry_time The expiry time to be used for the timer.
*
* @param ec Set to indicate what error occurred, if any.
*
* @return The number of asynchronous operations that were cancelled.
*/
std::size_t expires_from_now(const duration_type& expiry_time,
asio::error_code& ec)
{
return this->service.expires_from_now(
this->implementation, expiry_time, ec);
}
/// Perform a blocking wait on the timer.
/**
* This function is used to wait for the timer to expire. This function
* blocks and does not return until the timer has expired.
*
* @throws asio::system_error Thrown on failure.
*/
void wait()
{
asio::error_code ec;
this->service.wait(this->implementation, ec);
asio::detail::throw_error(ec);
}
/// Perform a blocking wait on the timer.
/**
* This function is used to wait for the timer to expire. This function
* blocks and does not return until the timer has expired.
*
* @param ec Set to indicate what error occurred, if any.
*/
void wait(asio::error_code& ec)
{
this->service.wait(this->implementation, ec);
}
/// Start an asynchronous wait on the timer.
/**
* This function may be used to initiate an asynchronous wait against the
* timer. It always returns immediately.
*
* For each call to async_wait(), the supplied handler will be called exactly
* once. The handler will be called when:
*
* @li The timer has expired.
*
* @li The timer was cancelled, in which case the handler is passed the error
* code asio::error::operation_aborted.
*
* @param handler The handler to be called when the timer expires. Copies
* will be made of the handler as required. The function signature of the
* handler must be:
* @code void handler(
* const asio::error_code& error // Result of operation.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*/
template <typename WaitHandler>
void async_wait(WaitHandler handler)
{
this->service.async_wait(this->implementation, handler);
}
};
} // namespace asio

View File

@ -2,7 +2,7 @@
// basic_io_object.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -23,18 +23,19 @@
namespace asio {
/// Base class for all I/O objects.
template <typename Service>
template <typename IoObjectService>
class basic_io_object
: private noncopyable
{
public:
/// The type of the service that will be used to provide I/O operations.
typedef Service service_type;
typedef IoObjectService service_type;
/// The underlying implementation type of I/O object.
typedef typename service_type::implementation_type implementation_type;
/// Get the io_service associated with the object.
/// (Deprecated: use get_io_service().) Get the io_service associated with
/// the object.
/**
* This function may be used to obtain the io_service object that the I/O
* object uses to dispatch handlers for asynchronous operations.
@ -44,13 +45,26 @@ public:
*/
asio::io_service& io_service()
{
return service.io_service();
return service.get_io_service();
}
/// Get the io_service associated with the object.
/**
* This function may be used to obtain the io_service object that the I/O
* object uses to dispatch handlers for asynchronous operations.
*
* @return A reference to the io_service object that the I/O object will use
* to dispatch handlers. Ownership is not transferred to the caller.
*/
asio::io_service& get_io_service()
{
return service.get_io_service();
}
protected:
/// Construct a basic_io_object.
explicit basic_io_object(asio::io_service& io_service)
: service(asio::use_service<Service>(io_service))
: service(asio::use_service<IoObjectService>(io_service))
{
service.construct(implementation);
}

View File

@ -2,7 +2,7 @@
// basic_socket.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -19,8 +19,8 @@
#include "asio/basic_io_object.hpp"
#include "asio/error.hpp"
#include "asio/error_handler.hpp"
#include "asio/socket_base.hpp"
#include "asio/detail/throw_error.hpp"
namespace asio {
@ -29,21 +29,18 @@ namespace asio {
* The basic_socket class template provides functionality that is common to both
* stream-oriented and datagram-oriented sockets.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Error_Source, IO_Object.
*/
template <typename Protocol, typename Service>
template <typename Protocol, typename SocketService>
class basic_socket
: public basic_io_object<Service>,
: public basic_io_object<SocketService>,
public socket_base
{
public:
/// The native representation of a socket.
typedef typename Service::native_type native_type;
typedef typename SocketService::native_type native_type;
/// The protocol type.
typedef Protocol protocol_type;
@ -51,11 +48,8 @@ public:
/// The endpoint type.
typedef typename Protocol::endpoint endpoint_type;
/// The type used for reporting errors.
typedef asio::error error_type;
/// A basic_socket is always the lowest layer.
typedef basic_socket<Protocol, Service> lowest_layer_type;
typedef basic_socket<Protocol, SocketService> lowest_layer_type;
/// Construct a basic_socket without opening it.
/**
@ -65,7 +59,7 @@ public:
* dispatch handlers for any asynchronous operations performed on the socket.
*/
explicit basic_socket(asio::io_service& io_service)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketService>(io_service)
{
}
@ -78,13 +72,15 @@ public:
*
* @param protocol An object specifying protocol parameters to be used.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_socket(asio::io_service& io_service,
const protocol_type& protocol)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketService>(io_service)
{
this->service.open(this->implementation, protocol, throw_error());
asio::error_code ec;
this->service.open(this->implementation, protocol, ec);
asio::detail::throw_error(ec);
}
/// Construct a basic_socket, opening it and binding it to the given local
@ -100,15 +96,17 @@ public:
* @param endpoint An endpoint on the local machine to which the socket will
* be bound.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_socket(asio::io_service& io_service,
const endpoint_type& endpoint)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketService>(io_service)
{
this->service.open(this->implementation, endpoint.protocol(),
throw_error());
this->service.bind(this->implementation, endpoint, throw_error());
asio::error_code ec;
this->service.open(this->implementation, endpoint.protocol(), ec);
asio::detail::throw_error(ec);
this->service.bind(this->implementation, endpoint, ec);
asio::detail::throw_error(ec);
}
/// Construct a basic_socket on an existing native socket.
@ -122,14 +120,15 @@ public:
*
* @param native_socket A native socket.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_socket(asio::io_service& io_service,
const protocol_type& protocol, const native_type& native_socket)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketService>(io_service)
{
this->service.assign(this->implementation, protocol, native_socket,
throw_error());
asio::error_code ec;
this->service.assign(this->implementation, protocol, native_socket, ec);
asio::detail::throw_error(ec);
}
/// Get a reference to the lowest layer.
@ -152,9 +151,9 @@ public:
*
* @param protocol An object specifying protocol parameters to be used.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* socket.open(asio::ip::tcp::v4());
@ -162,7 +161,9 @@ public:
*/
void open(const protocol_type& protocol = protocol_type())
{
this->service.open(this->implementation, protocol, throw_error());
asio::error_code ec;
this->service.open(this->implementation, protocol, ec);
asio::detail::throw_error(ec);
}
/// Open the socket using the specified protocol.
@ -171,28 +172,23 @@ public:
*
* @param protocol An object specifying which protocol is to be used.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* asio::error error;
* socket.open(asio::ip::tcp::v4(), asio::assign_error(error));
* if (error)
* asio::error_code ec;
* socket.open(asio::ip::tcp::v4(), ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void open(const protocol_type& protocol, Error_Handler error_handler)
asio::error_code open(const protocol_type& protocol,
asio::error_code& ec)
{
this->service.open(this->implementation, protocol, error_handler);
return this->service.open(this->implementation, protocol, ec);
}
/// Assign an existing native socket to the socket.
@ -203,12 +199,13 @@ public:
*
* @param native_socket A native socket.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
void assign(const protocol_type& protocol, const native_type& native_socket)
{
this->service.assign(this->implementation, protocol, native_socket,
throw_error());
asio::error_code ec;
this->service.assign(this->implementation, protocol, native_socket, ec);
asio::detail::throw_error(ec);
}
/// Assign an existing native socket to the socket.
@ -219,19 +216,19 @@ public:
*
* @param native_socket A native socket.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*/
template <typename Error_Handler>
void assign(const protocol_type& protocol, const native_type& native_socket,
Error_Handler error_handler)
asio::error_code assign(const protocol_type& protocol,
const native_type& native_socket, asio::error_code& ec)
{
this->service.assign(this->implementation, protocol, native_socket,
error_handler);
return this->service.assign(this->implementation,
protocol, native_socket, ec);
}
/// Determine whether the socket is open.
bool is_open() const
{
return this->service.is_open(this->implementation);
}
/// Close the socket.
@ -240,11 +237,16 @@ public:
* or connect operations will be cancelled immediately, and will complete
* with the asio::error::operation_aborted error.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note For portable behaviour with respect to graceful closure of a
* connected socket, call shutdown() before closing the socket.
*/
void close()
{
this->service.close(this->implementation, throw_error());
asio::error_code ec;
this->service.close(this->implementation, ec);
asio::detail::throw_error(ec);
}
/// Close the socket.
@ -253,29 +255,26 @@ public:
* or connect operations will be cancelled immediately, and will complete
* with the asio::error::operation_aborted error.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::error error;
* socket.close(asio::assign_error(error));
* if (error)
* asio::error_code ec;
* socket.close(ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*
* @note For portable behaviour with respect to graceful closure of a
* connected socket, call shutdown() before closing the socket.
*/
template <typename Error_Handler>
void close(Error_Handler error_handler)
asio::error_code close(asio::error_code& ec)
{
this->service.close(this->implementation, error_handler);
return this->service.close(this->implementation, ec);
}
/// Get the native socket representation.
@ -295,11 +294,13 @@ public:
* operations to finish immediately, and the handlers for cancelled operations
* will be passed the asio::error::operation_aborted error.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
void cancel()
{
this->service.cancel(this->implementation, throw_error());
asio::error_code ec;
this->service.cancel(this->implementation, ec);
asio::detail::throw_error(ec);
}
/// Cancel all asynchronous operations associated with the socket.
@ -308,17 +309,77 @@ public:
* operations to finish immediately, and the handlers for cancelled operations
* will be passed the asio::error::operation_aborted error.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*/
template <typename Error_Handler>
void cancel(Error_Handler error_handler)
asio::error_code cancel(asio::error_code& ec)
{
this->service.cancel(this->implementation, error_handler);
return this->service.cancel(this->implementation, ec);
}
/// Determine whether the socket is at the out-of-band data mark.
/**
* This function is used to check whether the socket input is currently
* positioned at the out-of-band data mark.
*
* @return A bool indicating whether the socket is at the out-of-band data
* mark.
*
* @throws asio::system_error Thrown on failure.
*/
bool at_mark() const
{
asio::error_code ec;
bool b = this->service.at_mark(this->implementation, ec);
asio::detail::throw_error(ec);
return b;
}
/// Determine whether the socket is at the out-of-band data mark.
/**
* This function is used to check whether the socket input is currently
* positioned at the out-of-band data mark.
*
* @param ec Set to indicate what error occurred, if any.
*
* @return A bool indicating whether the socket is at the out-of-band data
* mark.
*/
bool at_mark(asio::error_code& ec) const
{
return this->service.at_mark(this->implementation, ec);
}
/// Determine the number of bytes available for reading.
/**
* This function is used to determine the number of bytes that may be read
* without blocking.
*
* @return The number of bytes that may be read without blocking, or 0 if an
* error occurs.
*
* @throws asio::system_error Thrown on failure.
*/
std::size_t available() const
{
asio::error_code ec;
std::size_t s = this->service.available(this->implementation, ec);
asio::detail::throw_error(ec);
return s;
}
/// Determine the number of bytes available for reading.
/**
* This function is used to determine the number of bytes that may be read
* without blocking.
*
* @param ec Set to indicate what error occurred, if any.
*
* @return The number of bytes that may be read without blocking, or 0 if an
* error occurs.
*/
std::size_t available(asio::error_code& ec) const
{
return this->service.available(this->implementation, ec);
}
/// Bind the socket to the given local endpoint.
@ -329,9 +390,9 @@ public:
* @param endpoint An endpoint on the local machine to which the socket will
* be bound.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* socket.open(asio::ip::tcp::v4());
@ -341,7 +402,9 @@ public:
*/
void bind(const endpoint_type& endpoint)
{
this->service.bind(this->implementation, endpoint, throw_error());
asio::error_code ec;
this->service.bind(this->implementation, endpoint, ec);
asio::detail::throw_error(ec);
}
/// Bind the socket to the given local endpoint.
@ -352,31 +415,25 @@ public:
* @param endpoint An endpoint on the local machine to which the socket will
* be bound.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* socket.open(asio::ip::tcp::v4());
* asio::error error;
* asio::error_code ec;
* socket.bind(asio::ip::tcp::endpoint(
* asio::ip::tcp::v4(), 12345),
* asio::assign_error(error));
* if (error)
* asio::ip::tcp::v4(), 12345), ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void bind(const endpoint_type& endpoint, Error_Handler error_handler)
asio::error_code bind(const endpoint_type& endpoint,
asio::error_code& ec)
{
this->service.bind(this->implementation, endpoint, error_handler);
return this->service.bind(this->implementation, endpoint, ec);
}
/// Connect the socket to the specified endpoint.
@ -392,9 +449,9 @@ public:
* @param peer_endpoint The remote endpoint to which the socket will be
* connected.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* asio::ip::tcp::endpoint endpoint(
@ -404,7 +461,14 @@ public:
*/
void connect(const endpoint_type& peer_endpoint)
{
this->service.connect(this->implementation, peer_endpoint, throw_error());
asio::error_code ec;
if (!is_open())
{
this->service.open(this->implementation, peer_endpoint.protocol(), ec);
asio::detail::throw_error(ec);
}
this->service.connect(this->implementation, peer_endpoint, ec);
asio::detail::throw_error(ec);
}
/// Connect the socket to the specified endpoint.
@ -420,30 +484,34 @@ public:
* @param peer_endpoint The remote endpoint to which the socket will be
* connected.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* asio::ip::tcp::endpoint endpoint(
* asio::ip::address::from_string("1.2.3.4"), 12345);
* asio::error error;
* socket.connect(endpoint, asio::assign_error(error));
* if (error)
* asio::error_code ec;
* socket.connect(endpoint, ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void connect(const endpoint_type& peer_endpoint, Error_Handler error_handler)
asio::error_code connect(const endpoint_type& peer_endpoint,
asio::error_code& ec)
{
this->service.connect(this->implementation, peer_endpoint, error_handler);
if (!is_open())
{
if (this->service.open(this->implementation,
peer_endpoint.protocol(), ec))
{
return ec;
}
}
return this->service.connect(this->implementation, peer_endpoint, ec);
}
/// Start an asynchronous connect.
@ -462,16 +530,16 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error // Result of operation
* const asio::error_code& error // Result of operation
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*
* @par Example:
* @par Example
* @code
* void connect_handler(const asio::error& error)
* void connect_handler(const asio::error_code& error)
* {
* if (!error)
* {
@ -487,9 +555,21 @@ public:
* socket.async_connect(endpoint, connect_handler);
* @endcode
*/
template <typename Handler>
void async_connect(const endpoint_type& peer_endpoint, Handler handler)
template <typename ConnectHandler>
void async_connect(const endpoint_type& peer_endpoint, ConnectHandler handler)
{
if (!is_open())
{
asio::error_code ec;
if (this->service.open(this->implementation,
peer_endpoint.protocol(), ec))
{
this->get_io_service().post(
asio::detail::bind_handler(handler, ec));
return;
}
}
this->service.async_connect(this->implementation, peer_endpoint, handler);
}
@ -499,9 +579,9 @@ public:
*
* @param option The new option value to be set on the socket.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @sa Socket_Option @n
* @sa SettableSocketOption @n
* asio::socket_base::broadcast @n
* asio::socket_base::do_not_route @n
* asio::socket_base::keep_alive @n
@ -518,7 +598,7 @@ public:
* asio::ip::multicast::hops @n
* asio::ip::tcp::no_delay
*
* @par Example:
* @par Example
* Setting the IPPROTO_TCP/TCP_NODELAY option:
* @code
* asio::ip::tcp::socket socket(io_service);
@ -527,10 +607,12 @@ public:
* socket.set_option(option);
* @endcode
*/
template <typename Socket_Option>
void set_option(const Socket_Option& option)
template <typename SettableSocketOption>
void set_option(const SettableSocketOption& option)
{
this->service.set_option(this->implementation, option, throw_error());
asio::error_code ec;
this->service.set_option(this->implementation, option, ec);
asio::detail::throw_error(ec);
}
/// Set an option on the socket.
@ -539,14 +621,9 @@ public:
*
* @param option The new option value to be set on the socket.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @sa Socket_Option @n
* @sa SettableSocketOption @n
* asio::socket_base::broadcast @n
* asio::socket_base::do_not_route @n
* asio::socket_base::keep_alive @n
@ -563,24 +640,25 @@ public:
* asio::ip::multicast::hops @n
* asio::ip::tcp::no_delay
*
* @par Example:
* @par Example
* Setting the IPPROTO_TCP/TCP_NODELAY option:
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::ip::tcp::no_delay option(true);
* asio::error error;
* socket.set_option(option, asio::assign_error(error));
* if (error)
* asio::error_code ec;
* socket.set_option(option, ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Socket_Option, typename Error_Handler>
void set_option(const Socket_Option& option, Error_Handler error_handler)
template <typename SettableSocketOption>
asio::error_code set_option(const SettableSocketOption& option,
asio::error_code& ec)
{
this->service.set_option(this->implementation, option, error_handler);
return this->service.set_option(this->implementation, option, ec);
}
/// Get an option from the socket.
@ -589,9 +667,9 @@ public:
*
* @param option The option value to be obtained from the socket.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @sa Socket_Option @n
* @sa GettableSocketOption @n
* asio::socket_base::broadcast @n
* asio::socket_base::do_not_route @n
* asio::socket_base::keep_alive @n
@ -608,7 +686,7 @@ public:
* asio::ip::multicast::hops @n
* asio::ip::tcp::no_delay
*
* @par Example:
* @par Example
* Getting the value of the SOL_SOCKET/SO_KEEPALIVE option:
* @code
* asio::ip::tcp::socket socket(io_service);
@ -618,10 +696,12 @@ public:
* bool is_set = option.get();
* @endcode
*/
template <typename Socket_Option>
void get_option(Socket_Option& option) const
template <typename GettableSocketOption>
void get_option(GettableSocketOption& option) const
{
this->service.get_option(this->implementation, option, throw_error());
asio::error_code ec;
this->service.get_option(this->implementation, option, ec);
asio::detail::throw_error(ec);
}
/// Get an option from the socket.
@ -630,14 +710,9 @@ public:
*
* @param option The option value to be obtained from the socket.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @sa Socket_Option @n
* @sa GettableSocketOption @n
* asio::socket_base::broadcast @n
* asio::socket_base::do_not_route @n
* asio::socket_base::keep_alive @n
@ -654,25 +729,26 @@ public:
* asio::ip::multicast::hops @n
* asio::ip::tcp::no_delay
*
* @par Example:
* @par Example
* Getting the value of the SOL_SOCKET/SO_KEEPALIVE option:
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::ip::tcp::socket::keep_alive option;
* asio::error error;
* socket.get_option(option, asio::assign_error(error));
* if (error)
* asio::error_code ec;
* socket.get_option(option, ec);
* if (ec)
* {
* // An error occurred.
* }
* bool is_set = option.get();
* @endcode
*/
template <typename Socket_Option, typename Error_Handler>
void get_option(Socket_Option& option, Error_Handler error_handler) const
template <typename GettableSocketOption>
asio::error_code get_option(GettableSocketOption& option,
asio::error_code& ec) const
{
this->service.get_option(this->implementation, option, error_handler);
return this->service.get_option(this->implementation, option, ec);
}
/// Perform an IO control command on the socket.
@ -681,13 +757,13 @@ public:
*
* @param command The IO control command to be performed on the socket.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @sa IO_Control_Command @n
* @sa IoControlCommand @n
* asio::socket_base::bytes_readable @n
* asio::socket_base::non_blocking_io
*
* @par Example:
* @par Example
* Getting the number of bytes ready to read:
* @code
* asio::ip::tcp::socket socket(io_service);
@ -697,10 +773,12 @@ public:
* std::size_t bytes_readable = command.get();
* @endcode
*/
template <typename IO_Control_Command>
void io_control(IO_Control_Command& command)
template <typename IoControlCommand>
void io_control(IoControlCommand& command)
{
this->service.io_control(this->implementation, command, throw_error());
asio::error_code ec;
this->service.io_control(this->implementation, command, ec);
asio::detail::throw_error(ec);
}
/// Perform an IO control command on the socket.
@ -709,36 +787,32 @@ public:
*
* @param command The IO control command to be performed on the socket.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @sa IO_Control_Command @n
* @sa IoControlCommand @n
* asio::socket_base::bytes_readable @n
* asio::socket_base::non_blocking_io
*
* @par Example:
* @par Example
* Getting the number of bytes ready to read:
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::ip::tcp::socket::bytes_readable command;
* asio::error error;
* socket.io_control(command, asio::assign_error(error));
* if (error)
* asio::error_code ec;
* socket.io_control(command, ec);
* if (ec)
* {
* // An error occurred.
* }
* std::size_t bytes_readable = command.get();
* @endcode
*/
template <typename IO_Control_Command, typename Error_Handler>
void io_control(IO_Control_Command& command, Error_Handler error_handler)
template <typename IoControlCommand>
asio::error_code io_control(IoControlCommand& command,
asio::error_code& ec)
{
this->service.io_control(this->implementation, command, error_handler);
return this->service.io_control(this->implementation, command, ec);
}
/// Get the local endpoint of the socket.
@ -747,9 +821,9 @@ public:
*
* @returns An object that represents the local endpoint of the socket.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
@ -758,41 +832,36 @@ public:
*/
endpoint_type local_endpoint() const
{
return this->service.local_endpoint(this->implementation, throw_error());
asio::error_code ec;
endpoint_type ep = this->service.local_endpoint(this->implementation, ec);
asio::detail::throw_error(ec);
return ep;
}
/// Get the local endpoint of the socket.
/**
* This function is used to obtain the locally bound endpoint of the socket.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns An object that represents the local endpoint of the socket.
* Returns a default-constructed endpoint object if an error occurred and the
* error handler did not throw an exception.
* Returns a default-constructed endpoint object if an error occurred.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::error error;
* asio::ip::tcp::endpoint endpoint
* = socket.local_endpoint(asio::assign_error(error));
* if (error)
* asio::error_code ec;
* asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
endpoint_type local_endpoint(Error_Handler error_handler) const
endpoint_type local_endpoint(asio::error_code& ec) const
{
return this->service.local_endpoint(this->implementation, error_handler);
return this->service.local_endpoint(this->implementation, ec);
}
/// Get the remote endpoint of the socket.
@ -801,9 +870,9 @@ public:
*
* @returns An object that represents the remote endpoint of the socket.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
@ -812,41 +881,36 @@ public:
*/
endpoint_type remote_endpoint() const
{
return this->service.remote_endpoint(this->implementation, throw_error());
asio::error_code ec;
endpoint_type ep = this->service.remote_endpoint(this->implementation, ec);
asio::detail::throw_error(ec);
return ep;
}
/// Get the remote endpoint of the socket.
/**
* This function is used to obtain the remote endpoint of the socket.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns An object that represents the remote endpoint of the socket.
* Returns a default-constructed endpoint object if an error occurred and the
* error handler did not throw an exception.
* Returns a default-constructed endpoint object if an error occurred.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::error error;
* asio::ip::tcp::endpoint endpoint
* = socket.remote_endpoint(asio::assign_error(error));
* if (error)
* asio::error_code ec;
* asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
endpoint_type remote_endpoint(Error_Handler error_handler) const
endpoint_type remote_endpoint(asio::error_code& ec) const
{
return this->service.remote_endpoint(this->implementation, error_handler);
return this->service.remote_endpoint(this->implementation, ec);
}
/// Disable sends or receives on the socket.
@ -856,9 +920,9 @@ public:
*
* @param what Determines what types of operation will no longer be allowed.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* Shutting down the send side of the socket:
* @code
* asio::ip::tcp::socket socket(io_service);
@ -868,7 +932,9 @@ public:
*/
void shutdown(shutdown_type what)
{
this->service.shutdown(this->implementation, what, throw_error());
asio::error_code ec;
this->service.shutdown(this->implementation, what, ec);
asio::detail::throw_error(ec);
}
/// Disable sends or receives on the socket.
@ -878,31 +944,25 @@ public:
*
* @param what Determines what types of operation will no longer be allowed.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* Shutting down the send side of the socket:
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::error error;
* socket.shutdown(asio::ip::tcp::socket::shutdown_send,
* asio::assign_error(error));
* if (error)
* asio::error_code ec;
* socket.shutdown(asio::ip::tcp::socket::shutdown_send, ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void shutdown(shutdown_type what, Error_Handler error_handler)
asio::error_code shutdown(shutdown_type what,
asio::error_code& ec)
{
this->service.shutdown(this->implementation, what, error_handler);
return this->service.shutdown(this->implementation, what, ec);
}
protected:

View File

@ -2,7 +2,7 @@
// basic_socket_acceptor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -20,9 +20,9 @@
#include "asio/basic_io_object.hpp"
#include "asio/basic_socket.hpp"
#include "asio/error.hpp"
#include "asio/error_handler.hpp"
#include "asio/socket_acceptor_service.hpp"
#include "asio/socket_base.hpp"
#include "asio/detail/throw_error.hpp"
namespace asio {
@ -31,14 +31,11 @@ namespace asio {
* The basic_socket_acceptor class template is used for accepting new socket
* connections.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Async_Object, Error_Source.
*
* @par Example:
* @par Example
* Opening a socket acceptor with the SO_REUSEADDR option enabled:
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
@ -50,14 +47,14 @@ namespace asio {
* @endcode
*/
template <typename Protocol,
typename Service = socket_acceptor_service<Protocol> >
typename SocketAcceptorService = socket_acceptor_service<Protocol> >
class basic_socket_acceptor
: public basic_io_object<Service>,
: public basic_io_object<SocketAcceptorService>,
public socket_base
{
public:
/// The native representation of an acceptor.
typedef typename Service::native_type native_type;
typedef typename SocketAcceptorService::native_type native_type;
/// The protocol type.
typedef Protocol protocol_type;
@ -65,9 +62,6 @@ public:
/// The endpoint type.
typedef typename Protocol::endpoint endpoint_type;
/// The type used for reporting errors.
typedef asio::error error_type;
/// Construct an acceptor without opening it.
/**
* This constructor creates an acceptor without opening it to listen for new
@ -79,7 +73,7 @@ public:
* acceptor.
*/
explicit basic_socket_acceptor(asio::io_service& io_service)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketAcceptorService>(io_service)
{
}
@ -93,13 +87,15 @@ public:
*
* @param protocol An object specifying protocol parameters to be used.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_socket_acceptor(asio::io_service& io_service,
const protocol_type& protocol)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketAcceptorService>(io_service)
{
this->service.open(this->implementation, protocol, throw_error());
asio::error_code ec;
this->service.open(this->implementation, protocol, ec);
asio::detail::throw_error(ec);
}
/// Construct an acceptor opened on the given endpoint.
@ -117,7 +113,7 @@ public:
* @param reuse_addr Whether the constructor should set the socket option
* socket_base::reuse_address.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note This constructor is equivalent to the following code:
* @code
@ -131,18 +127,22 @@ public:
*/
basic_socket_acceptor(asio::io_service& io_service,
const endpoint_type& endpoint, bool reuse_addr = true)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketAcceptorService>(io_service)
{
this->service.open(this->implementation, endpoint.protocol(),
throw_error());
asio::error_code ec;
this->service.open(this->implementation, endpoint.protocol(), ec);
asio::detail::throw_error(ec);
if (reuse_addr)
{
this->service.set_option(this->implementation,
socket_base::reuse_address(true), throw_error());
socket_base::reuse_address(true), ec);
asio::detail::throw_error(ec);
}
this->service.bind(this->implementation, endpoint, throw_error());
this->service.bind(this->implementation, endpoint, ec);
asio::detail::throw_error(ec);
this->service.listen(this->implementation,
socket_base::max_connections, throw_error());
socket_base::max_connections, ec);
asio::detail::throw_error(ec);
}
/// Construct a basic_socket_acceptor on an existing native acceptor.
@ -158,14 +158,15 @@ public:
*
* @param native_acceptor A native acceptor.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_socket_acceptor(asio::io_service& io_service,
const protocol_type& protocol, const native_type& native_acceptor)
: basic_io_object<Service>(io_service)
: basic_io_object<SocketAcceptorService>(io_service)
{
this->service.assign(this->implementation, protocol, native_acceptor,
throw_error());
asio::error_code ec;
this->service.assign(this->implementation, protocol, native_acceptor, ec);
asio::detail::throw_error(ec);
}
/// Open the acceptor using the specified protocol.
@ -175,7 +176,9 @@ public:
*
* @param protocol An object specifying which protocol is to be used.
*
* @par Example:
* @throws asio::system_error Thrown on failure.
*
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* acceptor.open(asio::ip::tcp::v4());
@ -183,7 +186,9 @@ public:
*/
void open(const protocol_type& protocol = protocol_type())
{
this->service.open(this->implementation, protocol, throw_error());
asio::error_code ec;
this->service.open(this->implementation, protocol, ec);
asio::detail::throw_error(ec);
}
/// Open the acceptor using the specified protocol.
@ -193,29 +198,23 @@ public:
*
* @param protocol An object specifying which protocol is to be used.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* asio::error error;
* acceptor.open(asio::ip::tcp::v4(),
* asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.open(asio::ip::tcp::v4(), ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void open(const protocol_type& protocol, Error_Handler error_handler)
asio::error_code open(const protocol_type& protocol,
asio::error_code& ec)
{
this->service.open(this->implementation, protocol, error_handler);
return this->service.open(this->implementation, protocol, ec);
}
/// Assigns an existing native acceptor to the acceptor.
@ -226,12 +225,13 @@ public:
*
* @param native_acceptor A native acceptor.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
void assign(const protocol_type& protocol, const native_type& native_acceptor)
{
this->service.assign(this->implementation, protocol, native_acceptor,
throw_error());
asio::error_code ec;
this->service.assign(this->implementation, protocol, native_acceptor, ec);
asio::detail::throw_error(ec);
}
/// Assigns an existing native acceptor to the acceptor.
@ -242,19 +242,19 @@ public:
*
* @param native_acceptor A native acceptor.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*/
template <typename Error_Handler>
void assign(const protocol_type& protocol, const native_type& native_acceptor,
Error_Handler error_handler)
asio::error_code assign(const protocol_type& protocol,
const native_type& native_acceptor, asio::error_code& ec)
{
this->service.assign(this->implementation, protocol, native_acceptor,
error_handler);
return this->service.assign(this->implementation,
protocol, native_acceptor, ec);
}
/// Determine whether the acceptor is open.
bool is_open() const
{
return this->service.is_open(this->implementation);
}
/// Bind the acceptor to the given local endpoint.
@ -265,9 +265,9 @@ public:
* @param endpoint An endpoint on the local machine to which the socket
* acceptor will be bound.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* acceptor.open(asio::ip::tcp::v4());
@ -276,7 +276,9 @@ public:
*/
void bind(const endpoint_type& endpoint)
{
this->service.bind(this->implementation, endpoint, throw_error());
asio::error_code ec;
this->service.bind(this->implementation, endpoint, ec);
asio::detail::throw_error(ec);
}
/// Bind the acceptor to the given local endpoint.
@ -287,30 +289,24 @@ public:
* @param endpoint An endpoint on the local machine to which the socket
* acceptor will be bound.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* acceptor.open(asio::ip::tcp::v4());
* asio::error error;
* acceptor.bind(asio::ip::tcp::endpoint(12345),
* asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.bind(asio::ip::tcp::endpoint(12345), ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void bind(const endpoint_type& endpoint, Error_Handler error_handler)
asio::error_code bind(const endpoint_type& endpoint,
asio::error_code& ec)
{
this->service.bind(this->implementation, endpoint, error_handler);
return this->service.bind(this->implementation, endpoint, ec);
}
/// Place the acceptor into the state where it will listen for new
@ -320,10 +316,14 @@ public:
* new connections.
*
* @param backlog The maximum length of the queue of pending connections.
*
* @throws asio::system_error Thrown on failure.
*/
void listen(int backlog = socket_base::max_connections)
{
this->service.listen(this->implementation, backlog, throw_error());
asio::error_code ec;
this->service.listen(this->implementation, backlog, ec);
asio::detail::throw_error(ec);
}
/// Place the acceptor into the state where it will listen for new
@ -334,30 +334,23 @@ public:
*
* @param backlog The maximum length of the queue of pending connections.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::error error;
* acceptor.listen(asio::socket_base::max_connections,
* asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.listen(asio::socket_base::max_connections, ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void listen(int backlog, Error_Handler error_handler)
asio::error_code listen(int backlog, asio::error_code& ec)
{
this->service.listen(this->implementation, backlog, error_handler);
return this->service.listen(this->implementation, backlog, ec);
}
/// Close the acceptor.
@ -368,11 +361,13 @@ public:
* A subsequent call to open() is required before the acceptor can again be
* used to again perform socket accept operations.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
void close()
{
this->service.close(this->implementation, throw_error());
asio::error_code ec;
this->service.close(this->implementation, ec);
asio::detail::throw_error(ec);
}
/// Close the acceptor.
@ -383,29 +378,23 @@ public:
* A subsequent call to open() is required before the acceptor can again be
* used to again perform socket accept operations.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::error error;
* acceptor.close(asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.close(ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
void close(Error_Handler error_handler)
asio::error_code close(asio::error_code& ec)
{
this->service.close(this->implementation, error_handler);
return this->service.close(this->implementation, ec);
}
/// Get the native acceptor representation.
@ -425,11 +414,13 @@ public:
* operations to finish immediately, and the handlers for cancelled operations
* will be passed the asio::error::operation_aborted error.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
void cancel()
{
this->service.cancel(this->implementation, throw_error());
asio::error_code ec;
this->service.cancel(this->implementation, ec);
asio::detail::throw_error(ec);
}
/// Cancel all asynchronous operations associated with the acceptor.
@ -438,17 +429,11 @@ public:
* operations to finish immediately, and the handlers for cancelled operations
* will be passed the asio::error::operation_aborted error.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*/
template <typename Error_Handler>
void cancel(Error_Handler error_handler)
asio::error_code cancel(asio::error_code& ec)
{
this->service.cancel(this->implementation, error_handler);
return this->service.cancel(this->implementation, ec);
}
/// Set an option on the acceptor.
@ -457,13 +442,13 @@ public:
*
* @param option The new option value to be set on the acceptor.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @sa Socket_Option @n
* @sa SettableSocketOption @n
* asio::socket_base::reuse_address
* asio::socket_base::enable_connection_aborted
*
* @par Example:
* @par Example
* Setting the SOL_SOCKET/SO_REUSEADDR option:
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
@ -472,10 +457,12 @@ public:
* acceptor.set_option(option);
* @endcode
*/
template <typename Option>
void set_option(const Option& option)
template <typename SettableSocketOption>
void set_option(const SettableSocketOption& option)
{
this->service.set_option(this->implementation, option, throw_error());
asio::error_code ec;
this->service.set_option(this->implementation, option, ec);
asio::detail::throw_error(ec);
}
/// Set an option on the acceptor.
@ -484,35 +471,31 @@ public:
*
* @param option The new option value to be set on the acceptor.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @sa Socket_Option @n
* @sa SettableSocketOption @n
* asio::socket_base::reuse_address
* asio::socket_base::enable_connection_aborted
*
* @par Example:
* @par Example
* Setting the SOL_SOCKET/SO_REUSEADDR option:
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::ip::tcp::acceptor::reuse_address option(true);
* asio::error error;
* acceptor.set_option(option, asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.set_option(option, ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Option, typename Error_Handler>
void set_option(const Option& option, Error_Handler error_handler)
template <typename SettableSocketOption>
asio::error_code set_option(const SettableSocketOption& option,
asio::error_code& ec)
{
this->service.set_option(this->implementation, option, error_handler);
return this->service.set_option(this->implementation, option, ec);
}
/// Get an option from the acceptor.
@ -522,12 +505,12 @@ public:
*
* @param option The option value to be obtained from the acceptor.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @sa Socket_Option @n
* @sa GettableSocketOption @n
* asio::socket_base::reuse_address
*
* @par Example:
* @par Example
* Getting the value of the SOL_SOCKET/SO_REUSEADDR option:
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
@ -537,10 +520,12 @@ public:
* bool is_set = option.get();
* @endcode
*/
template <typename Option>
void get_option(Option& option)
template <typename GettableSocketOption>
void get_option(GettableSocketOption& option)
{
this->service.get_option(this->implementation, option, throw_error());
asio::error_code ec;
this->service.get_option(this->implementation, option, ec);
asio::detail::throw_error(ec);
}
/// Get an option from the acceptor.
@ -550,35 +535,31 @@ public:
*
* @param option The option value to be obtained from the acceptor.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @sa Socket_Option @n
* @sa GettableSocketOption @n
* asio::socket_base::reuse_address
*
* @par Example:
* @par Example
* Getting the value of the SOL_SOCKET/SO_REUSEADDR option:
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::ip::tcp::acceptor::reuse_address option;
* asio::error error;
* acceptor.get_option(option, asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.get_option(option, ec);
* if (ec)
* {
* // An error occurred.
* }
* bool is_set = option.get();
* @endcode
*/
template <typename Option, typename Error_Handler>
void get_option(Option& option, Error_Handler error_handler)
template <typename GettableSocketOption>
asio::error_code get_option(GettableSocketOption& option,
asio::error_code& ec)
{
this->service.get_option(this->implementation, option, error_handler);
return this->service.get_option(this->implementation, option, ec);
}
/// Get the local endpoint of the acceptor.
@ -587,9 +568,9 @@ public:
*
* @returns An object that represents the local endpoint of the acceptor.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
@ -598,41 +579,37 @@ public:
*/
endpoint_type local_endpoint() const
{
return this->service.local_endpoint(this->implementation, throw_error());
asio::error_code ec;
endpoint_type ep = this->service.local_endpoint(this->implementation, ec);
asio::detail::throw_error(ec);
return ep;
}
/// Get the local endpoint of the acceptor.
/**
* This function is used to obtain the locally bound endpoint of the acceptor.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns An object that represents the local endpoint of the acceptor.
* Returns a default-constructed endpoint object if an error occurred and the
* error handler did not throw an exception.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::error error;
* asio::ip::tcp::endpoint endpoint
* = acceptor.local_endpoint(asio::assign_error(error));
* if (error)
* asio::error_code ec;
* asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Error_Handler>
endpoint_type local_endpoint(Error_Handler error_handler) const
endpoint_type local_endpoint(asio::error_code& ec) const
{
return this->service.local_endpoint(this->implementation, error_handler);
return this->service.local_endpoint(this->implementation, ec);
}
/// Accept a new connection.
@ -643,9 +620,9 @@ public:
*
* @param peer The socket into which the new connection will be accepted.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
@ -653,10 +630,12 @@ public:
* acceptor.accept(socket);
* @endcode
*/
template <typename Socket_Service>
void accept(basic_socket<protocol_type, Socket_Service>& peer)
template <typename SocketService>
void accept(basic_socket<protocol_type, SocketService>& peer)
{
this->service.accept(this->implementation, peer, throw_error());
asio::error_code ec;
this->service.accept(this->implementation, peer, 0, ec);
asio::detail::throw_error(ec);
}
/// Accept a new connection.
@ -667,31 +646,27 @@ public:
*
* @param peer The socket into which the new connection will be accepted.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::ip::tcp::soocket socket(io_service);
* asio::error error;
* acceptor.accept(socket, asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.accept(socket, ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Socket_Service, typename Error_Handler>
void accept(basic_socket<protocol_type, Socket_Service>& peer,
Error_Handler error_handler)
template <typename SocketService>
asio::error_code accept(
basic_socket<protocol_type, SocketService>& peer,
asio::error_code& ec)
{
this->service.accept(this->implementation, peer, error_handler);
return this->service.accept(this->implementation, peer, 0, ec);
}
/// Start an asynchronous accept.
@ -707,16 +682,16 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error // Result of operation
* const asio::error_code& error // Result of operation.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*
* @par Example:
* @par Example
* @code
* void accept_handler(const asio::error& error)
* void accept_handler(const asio::error_code& error)
* {
* if (!error)
* {
@ -732,11 +707,11 @@ public:
* acceptor.async_accept(socket, accept_handler);
* @endcode
*/
template <typename Socket_Service, typename Handler>
void async_accept(basic_socket<protocol_type, Socket_Service>& peer,
Handler handler)
template <typename SocketService, typename AcceptHandler>
void async_accept(basic_socket<protocol_type, SocketService>& peer,
AcceptHandler handler)
{
this->service.async_accept(this->implementation, peer, handler);
this->service.async_accept(this->implementation, peer, 0, handler);
}
/// Accept a new connection and obtain the endpoint of the peer
@ -751,23 +726,24 @@ public:
* @param peer_endpoint An endpoint object which will receive the endpoint of
* the remote peer.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::ip::tcp::socket socket(io_service);
* asio::ip::tcp::endpoint endpoint;
* acceptor.accept_endpoint(socket, endpoint);
* acceptor.accept(socket, endpoint);
* @endcode
*/
template <typename Socket_Service>
void accept_endpoint(basic_socket<protocol_type, Socket_Service>& peer,
template <typename SocketService>
void accept(basic_socket<protocol_type, SocketService>& peer,
endpoint_type& peer_endpoint)
{
this->service.accept_endpoint(this->implementation, peer, peer_endpoint,
throw_error());
asio::error_code ec;
this->service.accept(this->implementation, peer, &peer_endpoint, ec);
asio::detail::throw_error(ec);
}
/// Accept a new connection and obtain the endpoint of the peer
@ -782,34 +758,28 @@ public:
* @param peer_endpoint An endpoint object which will receive the endpoint of
* the remote peer.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @par Example:
* @par Example
* @code
* asio::ip::tcp::acceptor acceptor(io_service);
* ...
* asio::ip::tcp::socket socket(io_service);
* asio::ip::tcp::endpoint endpoint;
* asio::error error;
* acceptor.accept_endpoint(socket, endpoint,
* asio::assign_error(error));
* if (error)
* asio::error_code ec;
* acceptor.accept(socket, endpoint, ec);
* if (ec)
* {
* // An error occurred.
* }
* @endcode
*/
template <typename Socket_Service, typename Error_Handler>
void accept_endpoint(basic_socket<protocol_type, Socket_Service>& peer,
endpoint_type& peer_endpoint, Error_Handler error_handler)
template <typename SocketService>
asio::error_code accept(
basic_socket<protocol_type, SocketService>& peer,
endpoint_type& peer_endpoint, asio::error_code& ec)
{
this->service.accept_endpoint(this->implementation, peer, peer_endpoint,
error_handler);
return this->service.accept(this->implementation, peer, &peer_endpoint, ec);
}
/// Start an asynchronous accept.
@ -831,19 +801,19 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error // Result of operation
* const asio::error_code& error // Result of operation.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
* of the handler will be performed in a manner equivalent to using
* asio::io_service::post().
*/
template <typename Socket_Service, typename Handler>
void async_accept_endpoint(basic_socket<protocol_type, Socket_Service>& peer,
endpoint_type& peer_endpoint, Handler handler)
template <typename SocketService, typename AcceptHandler>
void async_accept(basic_socket<protocol_type, SocketService>& peer,
endpoint_type& peer_endpoint, AcceptHandler handler)
{
this->service.async_accept_endpoint(this->implementation, peer,
peer_endpoint, handler);
this->service.async_accept(this->implementation,
peer, &peer_endpoint, handler);
}
};

View File

@ -2,7 +2,7 @@
// basic_socket_iostream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -33,74 +33,42 @@
#endif // !defined(ASIO_SOCKET_IOSTREAM_MAX_ARITY)
// A macro that should expand to:
// template < typename T1, ..., typename Tn >
// explicit basic_socket_iostream( T1 x1, ..., Tn xn )
// template <typename T1, ..., typename Tn>
// explicit basic_socket_iostream(T1 x1, ..., Tn xn)
// : basic_iostream<char>(&this->boost::base_from_member<
// basic_socket_streambuf<Protocol, Service> >::member)
// basic_socket_streambuf<Protocol, StreamSocketService> >::member)
// {
// try
// {
// rdbuf()->connect ( x1, ..., xn );
// }
// catch (asio::error&)
// {
// if (rdbuf()->connect(x1, ..., xn) == 0)
// this->setstate(std::ios_base::failbit);
// if (this->exceptions() & std::ios_base::failbit)
// throw;
// }
// }
// This macro should only persist within this file.
#define ASIO_PRIVATE_CTR_DEF( z, n, data ) \
template < BOOST_PP_ENUM_PARAMS(n, typename T) > \
explicit basic_socket_iostream( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) ) \
#define ASIO_PRIVATE_CTR_DEF(z, n, data) \
template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
explicit basic_socket_iostream(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
: std::basic_iostream<char>(&this->boost::base_from_member< \
basic_socket_streambuf<Protocol, Service> >::member) \
basic_socket_streambuf<Protocol, StreamSocketService> >::member) \
{ \
try \
{ \
rdbuf()->connect( BOOST_PP_ENUM_PARAMS(n, x) ); \
} \
catch (asio::error&) \
{ \
if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
this->setstate(std::ios_base::failbit); \
if (this->exceptions() & std::ios_base::failbit) \
throw; \
} \
} \
/**/
// A macro that should expand to:
// template < typename T1, ..., typename Tn >
// void connect( T1 x1, ..., Tn xn )
// template <typename T1, ..., typename Tn>
// void connect(T1 x1, ..., Tn xn)
// {
// try
// {
// rdbuf()->connect ( x1, ..., xn );
// }
// catch (asio::error&)
// {
// if (rdbuf()->connect(x1, ..., xn) == 0)
// this->setstate(std::ios_base::failbit);
// if (this->exceptions() & std::ios_base::failbit)
// throw;
// }
// }
// This macro should only persist within this file.
#define ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \
template < BOOST_PP_ENUM_PARAMS(n, typename T) > \
void connect( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) ) \
#define ASIO_PRIVATE_CONNECT_DEF(z, n, data) \
template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
void connect(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
{ \
try \
{ \
rdbuf()->connect( BOOST_PP_ENUM_PARAMS(n, x) ); \
} \
catch (asio::error&) \
{ \
if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
this->setstate(std::ios_base::failbit); \
if (this->exceptions() & std::ios_base::failbit) \
throw; \
} \
} \
/**/
@ -108,16 +76,17 @@ namespace asio {
/// Iostream interface for a socket.
template <typename Protocol,
typename Service = stream_socket_service<Protocol> >
typename StreamSocketService = stream_socket_service<Protocol> >
class basic_socket_iostream
: public boost::base_from_member<basic_socket_streambuf<Protocol, Service> >,
: public boost::base_from_member<
basic_socket_streambuf<Protocol, StreamSocketService> >,
public std::basic_iostream<char>
{
public:
/// Construct a basic_socket_iostream without establishing a connection.
basic_socket_iostream()
: std::basic_iostream<char>(&this->boost::base_from_member<
basic_socket_streambuf<Protocol, Service> >::member)
basic_socket_streambuf<Protocol, StreamSocketService> >::member)
{
}
@ -154,15 +123,16 @@ public:
/// Close the connection.
void close()
{
rdbuf()->close();
if (rdbuf()->close() == 0)
this->setstate(std::ios_base::failbit);
}
/// Return a pointer to the underlying streambuf.
basic_socket_streambuf<Protocol, Service>* rdbuf() const
basic_socket_streambuf<Protocol, StreamSocketService>* rdbuf() const
{
return const_cast<basic_socket_streambuf<Protocol, Service>*>(
return const_cast<basic_socket_streambuf<Protocol, StreamSocketService>*>(
&this->boost::base_from_member<
basic_socket_streambuf<Protocol, Service> >::member);
basic_socket_streambuf<Protocol, StreamSocketService> >::member);
}
};

View File

@ -2,7 +2,7 @@
// basic_socket_streambuf.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -28,61 +28,41 @@
#include "asio/detail/pop_options.hpp"
#include "asio/basic_socket.hpp"
#include "asio/error_handler.hpp"
#include "asio/io_service.hpp"
#include "asio/stream_socket_service.hpp"
#include "asio/detail/throw_error.hpp"
#if !defined(ASIO_SOCKET_STREAMBUF_MAX_ARITY)
#define ASIO_SOCKET_STREAMBUF_MAX_ARITY 5
#endif // !defined(ASIO_SOCKET_STREAMBUF_MAX_ARITY)
// A macro that should expand to:
// template < typename T1, ..., typename Tn >
// explicit basic_socket_streambuf( T1 x1, ..., Tn xn )
// : basic_socket<Protocol, Service>(
// boost::base_from_member<io_service>::member)
// template <typename T1, ..., typename Tn>
// basic_socket_streambuf<Protocol, StreamSocketService>* connect(
// T1 x1, ..., Tn xn)
// {
// init_buffers();
// asio::error_code ec;
// this->basic_socket<Protocol, StreamSocketService>::close(ec);
// typedef typename Protocol::resolver_query resolver_query;
// resolver_query query( x1, ..., xn );
// resolve_and_connect(query);
// }
// This macro should only persist within this file.
#define ASIO_PRIVATE_CTR_DEF( z, n, data ) \
template < BOOST_PP_ENUM_PARAMS(n, typename T) > \
explicit basic_socket_streambuf( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) ) \
: basic_socket<Protocol, Service>( \
boost::base_from_member<io_service>::member) \
{ \
init_buffers(); \
typedef typename Protocol::resolver_query resolver_query; \
resolver_query query( BOOST_PP_ENUM_PARAMS(n, x) ); \
resolve_and_connect(query); \
} \
/**/
// A macro that should expand to:
// template < typename T1, ..., typename Tn >
// void connect( T1 x1, ..., Tn xn )
// {
// this->basic_socket<Protocol, Service>::close();
// init_buffers();
// typedef typename Protocol::resolver_query resolver_query;
// resolver_query query( x1, ..., xn );
// resolve_and_connect(query);
// resolver_query query(x1, ..., xn);
// resolve_and_connect(query, ec);
// return !ec ? this : 0;
// }
// This macro should only persist within this file.
#define ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \
template < BOOST_PP_ENUM_PARAMS(n, typename T) > \
void connect( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) ) \
template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
basic_socket_streambuf<Protocol, StreamSocketService>* connect( \
BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
{ \
this->basic_socket<Protocol, Service>::close(); \
init_buffers(); \
asio::error_code ec; \
this->basic_socket<Protocol, StreamSocketService>::close(ec); \
typedef typename Protocol::resolver_query resolver_query; \
resolver_query query( BOOST_PP_ENUM_PARAMS(n, x) ); \
resolve_and_connect(query); \
resolver_query query(BOOST_PP_ENUM_PARAMS(n, x)); \
resolve_and_connect(query, ec); \
return !ec ? this : 0; \
} \
/**/
@ -90,11 +70,11 @@ namespace asio {
/// Iostream streambuf for a socket.
template <typename Protocol,
typename Service = stream_socket_service<Protocol> >
typename StreamSocketService = stream_socket_service<Protocol> >
class basic_socket_streambuf
: public std::streambuf,
private boost::base_from_member<io_service>,
public basic_socket<Protocol, Service>
public basic_socket<Protocol, StreamSocketService>
{
public:
/// The endpoint type.
@ -102,59 +82,50 @@ public:
/// Construct a basic_socket_streambuf without establishing a connection.
basic_socket_streambuf()
: basic_socket<Protocol, Service>(
boost::base_from_member<asio::io_service>::member)
: basic_socket<Protocol, StreamSocketService>(
boost::base_from_member<asio::io_service>::member),
unbuffered_(false)
{
init_buffers();
}
/// Establish a connection to the specified endpoint.
explicit basic_socket_streambuf(const endpoint_type& endpoint)
: basic_socket<Protocol, Service>(
boost::base_from_member<asio::io_service>::member)
{
init_buffers();
this->basic_socket<Protocol, Service>::connect(endpoint);
}
#if defined(GENERATING_DOCUMENTATION)
/// Establish a connection to an endpoint corresponding to a resolver query.
/**
* This constructor automatically establishes a connection based on the
* supplied resolver query parameters. The arguments are used to construct
* a resolver query object.
*/
template <typename T1, ..., typename TN>
explicit basic_socket_streambuf(T1 t1, ..., TN tn);
#else
BOOST_PP_REPEAT_FROM_TO(
1, BOOST_PP_INC(ASIO_SOCKET_STREAMBUF_MAX_ARITY),
ASIO_PRIVATE_CTR_DEF, _ )
#endif
/// Destructor flushes buffered data.
~basic_socket_streambuf()
virtual ~basic_socket_streambuf()
{
sync();
if (pptr() != pbase())
overflow(traits_type::eof());
}
/// Establish a connection to the specified endpoint.
void connect(const endpoint_type& endpoint)
/// Establish a connection.
/**
* This function establishes a connection to the specified endpoint.
*
* @return \c this if a connection was successfully established, a null
* pointer otherwise.
*/
basic_socket_streambuf<Protocol, StreamSocketService>* connect(
const endpoint_type& endpoint)
{
this->basic_socket<Protocol, Service>::close();
init_buffers();
this->basic_socket<Protocol, Service>::connect(endpoint);
asio::error_code ec;
this->basic_socket<Protocol, StreamSocketService>::close(ec);
this->basic_socket<Protocol, StreamSocketService>::connect(endpoint, ec);
return !ec ? this : 0;
}
#if defined(GENERATING_DOCUMENTATION)
/// Establish a connection to an endpoint corresponding to a resolver query.
/// Establish a connection.
/**
* This function automatically establishes a connection based on the supplied
* resolver query parameters. The arguments are used to construct a resolver
* query object.
*
* @return \c this if a connection was successfully established, a null
* pointer otherwise.
*/
template <typename T1, ..., typename TN>
void connect(T1 t1, ..., TN tn);
basic_socket_streambuf<Protocol, StreamSocketService>* connect(
T1 t1, ..., TN tn);
#else
BOOST_PP_REPEAT_FROM_TO(
1, BOOST_PP_INC(ASIO_SOCKET_STREAMBUF_MAX_ARITY),
@ -162,11 +133,18 @@ public:
#endif
/// Close the connection.
void close()
/**
* @return \c this if a connection was successfully established, a null
* pointer otherwise.
*/
basic_socket_streambuf<Protocol, StreamSocketService>* close()
{
asio::error_code ec;
sync();
this->basic_socket<Protocol, Service>::close();
init_buffers();
this->basic_socket<Protocol, StreamSocketService>::close(ec);
if (!ec)
init_buffers();
return !ec ? this : 0;
}
protected:
@ -174,17 +152,13 @@ protected:
{
if (gptr() == egptr())
{
asio::error error;
asio::error_code ec;
std::size_t bytes_transferred = this->service.receive(
this->implementation,
asio::buffer(asio::buffer(get_buffer_) + putback_max),
0, asio::assign_error(error));
if (error)
{
if (error != asio::error::eof)
throw error;
0, ec);
if (ec)
return traits_type::eof();
}
setg(get_buffer_.begin(), get_buffer_.begin() + putback_max,
get_buffer_.begin() + putback_max + bytes_transferred);
return traits_type::to_int_type(*gptr());
@ -197,42 +171,67 @@ protected:
int_type overflow(int_type c)
{
if (!traits_type::eq_int_type(c, traits_type::eof()))
if (unbuffered_)
{
if (pptr() == epptr())
if (traits_type::eq_int_type(c, traits_type::eof()))
{
asio::const_buffer buffer =
asio::buffer(pbase(), pptr() - pbase());
while (asio::buffer_size(buffer) > 0)
{
std::size_t bytes_transferred = this->service.send(
this->implementation, asio::buffer(buffer),
0, asio::throw_error());
buffer = buffer + bytes_transferred;
}
setp(put_buffer_.begin(), put_buffer_.end());
// Nothing to do.
return traits_type::not_eof(c);
}
else
{
// Send the single character immediately.
asio::error_code ec;
char_type ch = traits_type::to_char_type(c);
this->service.send(this->implementation,
asio::buffer(&ch, sizeof(char_type)), 0, ec);
if (ec)
return traits_type::eof();
return c;
}
}
else
{
// Send all data in the output buffer.
asio::const_buffer buffer =
asio::buffer(pbase(), pptr() - pbase());
while (asio::buffer_size(buffer) > 0)
{
asio::error_code ec;
std::size_t bytes_transferred = this->service.send(
this->implementation, asio::buffer(buffer),
0, ec);
if (ec)
return traits_type::eof();
buffer = buffer + bytes_transferred;
}
setp(put_buffer_.begin(), put_buffer_.end());
// If the new character is eof then our work here is done.
if (traits_type::eq_int_type(c, traits_type::eof()))
return traits_type::not_eof(c);
// Add the new character to the output buffer.
*pptr() = traits_type::to_char_type(c);
pbump(1);
return c;
}
return traits_type::not_eof(c);
}
int sync()
{
asio::const_buffer buffer =
asio::buffer(pbase(), pptr() - pbase());
while (asio::buffer_size(buffer) > 0)
return overflow(traits_type::eof());
}
std::streambuf* setbuf(char_type* s, std::streamsize n)
{
if (pptr() == pbase() && s == 0 && n == 0)
{
std::size_t bytes_transferred = this->service.send(
this->implementation, asio::buffer(buffer),
0, asio::throw_error());
buffer = buffer + bytes_transferred;
unbuffered_ = true;
setp(0, 0);
return this;
}
setp(put_buffer_.begin(), put_buffer_.end());
return 0;
}
@ -242,37 +241,42 @@ private:
setg(get_buffer_.begin(),
get_buffer_.begin() + putback_max,
get_buffer_.begin() + putback_max);
setp(put_buffer_.begin(), put_buffer_.end());
if (unbuffered_)
setp(0, 0);
else
setp(put_buffer_.begin(), put_buffer_.end());
}
void resolve_and_connect(const typename Protocol::resolver_query& query)
void resolve_and_connect(const typename Protocol::resolver_query& query,
asio::error_code& ec)
{
typedef typename Protocol::resolver resolver_type;
typedef typename Protocol::resolver_iterator iterator_type;
resolver_type resolver(
boost::base_from_member<asio::io_service>::member);
iterator_type iterator = resolver.resolve(query);
asio::error error(asio::error::host_not_found);
while (error && iterator != iterator_type())
iterator_type i = resolver.resolve(query, ec);
if (!ec)
{
this->basic_socket<Protocol, Service>::close();
this->basic_socket<Protocol, Service>::connect(
*iterator, asio::assign_error(error));
++iterator;
iterator_type end;
ec = asio::error::host_not_found;
while (ec && i != end)
{
this->basic_socket<Protocol, StreamSocketService>::close();
this->basic_socket<Protocol, StreamSocketService>::connect(*i, ec);
++i;
}
}
if (error)
throw error;
}
enum { putback_max = 8 };
enum { buffer_size = 512 };
boost::array<char, buffer_size> get_buffer_;
boost::array<char, buffer_size> put_buffer_;
bool unbuffered_;
};
} // namespace asio
#undef ASIO_PRIVATE_CTR_DEF
#undef ASIO_PRIVATE_CONNECT_DEF
#include "asio/detail/pop_options.hpp"

View File

@ -2,7 +2,7 @@
// basic_stream_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -23,8 +23,9 @@
#include "asio/detail/pop_options.hpp"
#include "asio/basic_socket.hpp"
#include "asio/error_handler.hpp"
#include "asio/error.hpp"
#include "asio/stream_socket_service.hpp"
#include "asio/detail/throw_error.hpp"
namespace asio {
@ -33,22 +34,21 @@ namespace asio {
* The basic_stream_socket class template provides asynchronous and blocking
* stream-oriented socket functionality.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Async_Read_Stream, Async_Write_Stream, Error_Source, IO_Object, Stream,
* Sync_Read_Stream, Sync_Write_Stream.
* AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
*/
template <typename Protocol,
typename Service = stream_socket_service<Protocol> >
typename StreamSocketService = stream_socket_service<Protocol> >
class basic_stream_socket
: public basic_socket<Protocol, Service>
: public basic_socket<Protocol, StreamSocketService>
{
public:
/// The native representation of a socket.
typedef typename Service::native_type native_type;
typedef typename StreamSocketService::native_type native_type;
/// The protocol type.
typedef Protocol protocol_type;
@ -66,7 +66,7 @@ public:
* dispatch handlers for any asynchronous operations performed on the socket.
*/
explicit basic_stream_socket(asio::io_service& io_service)
: basic_socket<Protocol, Service>(io_service)
: basic_socket<Protocol, StreamSocketService>(io_service)
{
}
@ -80,11 +80,11 @@ public:
*
* @param protocol An object specifying protocol parameters to be used.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_stream_socket(asio::io_service& io_service,
const protocol_type& protocol)
: basic_socket<Protocol, Service>(io_service, protocol)
: basic_socket<Protocol, StreamSocketService>(io_service, protocol)
{
}
@ -101,11 +101,11 @@ public:
* @param endpoint An endpoint on the local machine to which the stream
* socket will be bound.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_stream_socket(asio::io_service& io_service,
const endpoint_type& endpoint)
: basic_socket<Protocol, Service>(io_service, endpoint)
: basic_socket<Protocol, StreamSocketService>(io_service, endpoint)
{
}
@ -121,11 +121,12 @@ public:
*
* @param native_socket The new underlying socket implementation.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*/
basic_stream_socket(asio::io_service& io_service,
const protocol_type& protocol, const native_type& native_socket)
: basic_socket<Protocol, Service>(io_service, protocol, native_socket)
: basic_socket<Protocol, StreamSocketService>(
io_service, protocol, native_socket)
{
}
@ -139,13 +140,13 @@ public:
*
* @returns The number of bytes sent.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note The send operation may not transmit all of the data to the peer.
* Consider using the @ref write function if you need to ensure that all data
* is written before the blocking operation completes.
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code
* socket.send(asio::buffer(data, size));
@ -154,10 +155,14 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers>
std::size_t send(const Const_Buffers& buffers)
template <typename ConstBufferSequence>
std::size_t send(const ConstBufferSequence& buffers)
{
return this->service.send(this->implementation, buffers, 0, throw_error());
asio::error_code ec;
std::size_t s = this->service.send(
this->implementation, buffers, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Send some data on the socket.
@ -172,13 +177,13 @@ public:
*
* @returns The number of bytes sent.
*
* @throws asio::error Thrown on failure.
* @throws asio::system_error Thrown on failure.
*
* @note The send operation may not transmit all of the data to the peer.
* Consider using the @ref write function if you need to ensure that all data
* is written before the blocking operation completes.
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code
* socket.send(asio::buffer(data, size), 0);
@ -187,12 +192,15 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers>
std::size_t send(const Const_Buffers& buffers,
template <typename ConstBufferSequence>
std::size_t send(const ConstBufferSequence& buffers,
socket_base::message_flags flags)
{
return this->service.send(this->implementation, buffers, flags,
throw_error());
asio::error_code ec;
std::size_t s = this->service.send(
this->implementation, buffers, flags, ec);
asio::detail::throw_error(ec);
return s;
}
/// Send some data on the socket.
@ -205,27 +213,19 @@ public:
*
* @param flags Flags specifying how the send call is to be made.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes sent. Returns 0 if an error occurred and the
* error handler did not throw an exception.
* @returns The number of bytes sent. Returns 0 if an error occurred.
*
* @note The send operation may not transmit all of the data to the peer.
* Consider using the @ref write function if you need to ensure that all data
* is written before the blocking operation completes.
*/
template <typename Const_Buffers, typename Error_Handler>
std::size_t send(const Const_Buffers& buffers,
socket_base::message_flags flags,
Error_Handler error_handler)
template <typename ConstBufferSequence>
std::size_t send(const ConstBufferSequence& buffers,
socket_base::message_flags flags, asio::error_code& ec)
{
return this->service.send(this->implementation, buffers, flags,
error_handler);
return this->service.send(this->implementation, buffers, flags, ec);
}
/// Start an asynchronous send.
@ -242,8 +242,8 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -254,7 +254,7 @@ public:
* Consider using the @ref async_write function if you need to ensure that all
* data is written before the asynchronous operation completes.
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code
* socket.async_send(asio::buffer(data, size), handler);
@ -263,8 +263,8 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers, typename Handler>
void async_send(const Const_Buffers& buffers, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
{
this->service.async_send(this->implementation, buffers, 0, handler);
}
@ -285,8 +285,8 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes sent.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -297,7 +297,7 @@ public:
* Consider using the @ref async_write function if you need to ensure that all
* data is written before the asynchronous operation completes.
*
* @par Example:
* @par Example
* To send a single data buffer use the @ref buffer function as follows:
* @code
* socket.async_send(asio::buffer(data, size), 0, handler);
@ -306,9 +306,9 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers, typename Handler>
void async_send(const Const_Buffers& buffers,
socket_base::message_flags flags, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_send(const ConstBufferSequence& buffers,
socket_base::message_flags flags, WriteHandler handler)
{
this->service.async_send(this->implementation, buffers, flags, handler);
}
@ -323,7 +323,7 @@ public:
*
* @returns The number of bytes received.
*
* @throws asio::error Thrown on failure. An error code of
* @throws asio::system_error Thrown on failure. An error code of
* asio::error::eof indicates that the connection was closed by the
* peer.
*
@ -331,7 +331,7 @@ public:
* bytes. Consider using the @ref read function if you need to ensure that the
* requested amount of data is read before the blocking operation completes.
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code
@ -341,11 +341,13 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers>
std::size_t receive(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t receive(const MutableBufferSequence& buffers)
{
return this->service.receive(this->implementation, buffers, 0,
throw_error());
asio::error_code ec;
std::size_t s = this->service.receive(this->implementation, buffers, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Receive some data on the socket.
@ -360,7 +362,7 @@ public:
*
* @returns The number of bytes received.
*
* @throws asio::error Thrown on failure. An error code of
* @throws asio::system_error Thrown on failure. An error code of
* asio::error::eof indicates that the connection was closed by the
* peer.
*
@ -368,7 +370,7 @@ public:
* bytes. Consider using the @ref read function if you need to ensure that the
* requested amount of data is read before the blocking operation completes.
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code
@ -378,12 +380,15 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers>
std::size_t receive(const Mutable_Buffers& buffers,
template <typename MutableBufferSequence>
std::size_t receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags)
{
return this->service.receive(this->implementation, buffers, flags,
throw_error());
asio::error_code ec;
std::size_t s = this->service.receive(
this->implementation, buffers, flags, ec);
asio::detail::throw_error(ec);
return s;
}
/// Receive some data on a connected socket.
@ -396,26 +401,19 @@ public:
*
* @param flags Flags specifying how the receive call is to be made.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes received. Returns 0 if an error occurred and
* the error handler did not throw an exception.
* @returns The number of bytes received. Returns 0 if an error occurred.
*
* @note The receive operation may not receive all of the requested number of
* bytes. Consider using the @ref read function if you need to ensure that the
* requested amount of data is read before the blocking operation completes.
*/
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t receive(const Mutable_Buffers& buffers,
socket_base::message_flags flags, Error_Handler error_handler)
template <typename MutableBufferSequence>
std::size_t receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags, asio::error_code& ec)
{
return this->service.receive(this->implementation, buffers, flags,
error_handler);
return this->service.receive(this->implementation, buffers, flags, ec);
}
/// Start an asynchronous receive.
@ -432,8 +430,8 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -445,7 +443,7 @@ public:
* that the requested amount of data is received before the asynchronous
* operation completes.
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code
@ -455,8 +453,8 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers, typename Handler>
void async_receive(const Mutable_Buffers& buffers, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
{
this->service.async_receive(this->implementation, buffers, 0, handler);
}
@ -477,8 +475,8 @@ public:
* completes. Copies will be made of the handler as required. The function
* signature of the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes received.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -490,7 +488,7 @@ public:
* that the requested amount of data is received before the asynchronous
* operation completes.
*
* @par Example:
* @par Example
* To receive into a single data buffer use the @ref buffer function as
* follows:
* @code
@ -500,9 +498,9 @@ public:
* multiple buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers, typename Handler>
void async_receive(const Mutable_Buffers& buffers,
socket_base::message_flags flags, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive(const MutableBufferSequence& buffers,
socket_base::message_flags flags, ReadHandler handler)
{
this->service.async_receive(this->implementation, buffers, flags, handler);
}
@ -517,7 +515,7 @@ public:
*
* @returns The number of bytes written.
*
* @throws asio::error Thrown on failure. An error code of
* @throws asio::system_error Thrown on failure. An error code of
* asio::error::eof indicates that the connection was closed by the
* peer.
*
@ -525,7 +523,7 @@ public:
* peer. Consider using the @ref write function if you need to ensure that
* all data is written before the blocking operation completes.
*
* @par Example:
* @par Example
* To write a single data buffer use the @ref buffer function as follows:
* @code
* socket.write_some(asio::buffer(data, size));
@ -534,10 +532,13 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers>
std::size_t write_some(const Const_Buffers& buffers)
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers)
{
return this->service.send(this->implementation, buffers, 0, throw_error());
asio::error_code ec;
std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Write some data to the socket.
@ -548,25 +549,19 @@ public:
*
* @param buffers One or more data buffers to be written to the socket.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes written. Returns 0 if an error occurred and
* the error handler did not throw an exception.
* @returns The number of bytes written. Returns 0 if an error occurred.
*
* @note The write_some operation may not transmit all of the data to the
* peer. Consider using the @ref write function if you need to ensure that
* all data is written before the blocking operation completes.
*/
template <typename Const_Buffers, typename Error_Handler>
std::size_t write_some(const Const_Buffers& buffers,
Error_Handler error_handler)
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers,
asio::error_code& ec)
{
return this->service.send(this->implementation, buffers, 0, error_handler);
return this->service.send(this->implementation, buffers, 0, ec);
}
/// Start an asynchronous write.
@ -583,8 +578,8 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes written.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes written.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -595,7 +590,7 @@ public:
* Consider using the @ref async_write function if you need to ensure that all
* data is written before the asynchronous operation completes.
*
* @par Example:
* @par Example
* To write a single data buffer use the @ref buffer function as follows:
* @code
* socket.async_write_some(asio::buffer(data, size), handler);
@ -604,8 +599,9 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Const_Buffers, typename Handler>
void async_write_some(const Const_Buffers& buffers, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_write_some(const ConstBufferSequence& buffers,
WriteHandler handler)
{
this->service.async_send(this->implementation, buffers, 0, handler);
}
@ -620,7 +616,7 @@ public:
*
* @returns The number of bytes read.
*
* @throws asio::error Thrown on failure. An error code of
* @throws asio::system_error Thrown on failure. An error code of
* asio::error::eof indicates that the connection was closed by the
* peer.
*
@ -629,7 +625,7 @@ public:
* the requested amount of data is read before the blocking operation
* completes.
*
* @par Example:
* @par Example
* To read into a single data buffer use the @ref buffer function as follows:
* @code
* socket.read_some(asio::buffer(data, size));
@ -638,11 +634,13 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers>
std::size_t read_some(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers)
{
return this->service.receive(this->implementation, buffers, 0,
throw_error());
asio::error_code ec;
std::size_t s = this->service.receive(this->implementation, buffers, 0, ec);
asio::detail::throw_error(ec);
return s;
}
/// Read some data from the socket.
@ -653,27 +651,20 @@ public:
*
* @param buffers One or more buffers into which the data will be read.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
* @param ec Set to indicate what error occurred, if any.
*
* @returns The number of bytes read. Returns 0 if an error occurred and the
* error handler did not throw an exception.
* @returns The number of bytes read. Returns 0 if an error occurred.
*
* @note The read_some operation may not read all of the requested number of
* bytes. Consider using the @ref read function if you need to ensure that
* the requested amount of data is read before the blocking operation
* completes.
*/
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t read_some(const Mutable_Buffers& buffers,
Error_Handler error_handler)
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers,
asio::error_code& ec)
{
return this->service.receive(this->implementation, buffers, 0,
error_handler);
return this->service.receive(this->implementation, buffers, 0, ec);
}
/// Start an asynchronous read.
@ -690,8 +681,8 @@ public:
* Copies will be made of the handler as required. The function signature of
* the handler must be:
* @code void handler(
* const asio::error& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes read.
* const asio::error_code& error, // Result of operation.
* std::size_t bytes_transferred // Number of bytes read.
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. Invocation
@ -703,7 +694,7 @@ public:
* requested amount of data is read before the asynchronous operation
* completes.
*
* @par Example:
* @par Example
* To read into a single data buffer use the @ref buffer function as follows:
* @code
* socket.async_read_some(asio::buffer(data, size), handler);
@ -712,101 +703,12 @@ public:
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers, typename Handler>
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_read_some(const MutableBufferSequence& buffers,
ReadHandler handler)
{
this->service.async_receive(this->implementation, buffers, 0, handler);
}
/// Peek at the incoming data on the stream socket.
/**
* This function is used to peek at the incoming data on the stream socket,
* without removing it from the input queue. The function call will block
* until data has been read successfully or an error occurs.
*
* @param buffers One or more buffers into which the data will be read.
*
* @returns The number of bytes read.
*
* @throws asio::error Thrown on failure.
*
* @par Example:
* To peek using a single data buffer use the @ref buffer function as
* follows:
* @code socket.peek(asio::buffer(data, size)); @endcode
* See the @ref buffer documentation for information on using multiple
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*/
template <typename Mutable_Buffers>
std::size_t peek(const Mutable_Buffers& buffers)
{
return this->service.receive(this->implementation, buffers,
socket_base::message_peek, throw_error());
}
/// Peek at the incoming data on the stream socket.
/**
* This function is used to peek at the incoming data on the stream socket,
* without removing it from the input queue. The function call will block
* until data has been read successfully or an error occurs.
*
* @param buffers One or more buffers into which the data will be read.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation.
* ); @endcode
*
* @returns The number of bytes read. Returns 0 if an error occurred and the
* error handler did not throw an exception.
*/
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t peek(const Mutable_Buffers& buffers, Error_Handler error_handler)
{
return this->service.receive(this->implementation, buffers,
socket_base::message_peek, error_handler);
}
/// Determine the amount of data that may be read without blocking.
/**
* This function is used to determine the amount of data, in bytes, that may
* be read from the stream socket without blocking.
*
* @returns The number of bytes of data that can be read without blocking.
*
* @throws asio::error Thrown on failure.
*/
std::size_t in_avail()
{
socket_base::bytes_readable command;
this->service.io_control(this->implementation, command, throw_error());
return command.get();
}
/// Determine the amount of data that may be read without blocking.
/**
* This function is used to determine the amount of data, in bytes, that may
* be read from the stream socket without blocking.
*
* @param error_handler A handler to be called when the operation completes,
* to indicate whether or not an error has occurred. Copies will be made of
* the handler as required. The function signature of the handler must be:
* @code void error_handler(
* const asio::error& error // Result of operation
* ); @endcode
*
* @returns The number of bytes of data that can be read without blocking.
*/
template <typename Error_Handler>
std::size_t in_avail(Error_Handler error_handler)
{
socket_base::bytes_readable command;
this->service.io_control(this->implementation, command, error_handler);
return command.get();
}
};
} // namespace asio

View File

@ -2,7 +2,7 @@
// basic_streambuf.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -45,8 +45,8 @@ public:
/// The type used to represent the put area as a list of buffers.
typedef implementation_defined mutable_buffers_type;
#else
typedef asio::const_buffer_container_1 const_buffers_type;
typedef asio::mutable_buffer_container_1 mutable_buffers_type;
typedef asio::const_buffers_1 const_buffers_type;
typedef asio::mutable_buffers_1 mutable_buffers_type;
#endif
/// Construct a buffer with a specified maximum size.

View File

@ -2,7 +2,7 @@
// buffer.hpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -26,6 +26,28 @@
#include <vector>
#include "asio/detail/pop_options.hpp"
#if defined(BOOST_MSVC)
# if defined(_HAS_ITERATOR_DEBUGGING) && (_HAS_ITERATOR_DEBUGGING != 0)
# if !defined(ASIO_DISABLE_BUFFER_DEBUGGING)
# define ASIO_ENABLE_BUFFER_DEBUGGING
# endif // !defined(ASIO_DISABLE_BUFFER_DEBUGGING)
# endif // defined(_HAS_ITERATOR_DEBUGGING)
#endif // defined(BOOST_MSVC)
#if defined(__GNUC__)
# if defined(_GLIBCXX_DEBUG)
# if !defined(ASIO_DISABLE_BUFFER_DEBUGGING)
# define ASIO_ENABLE_BUFFER_DEBUGGING
# endif // !defined(ASIO_DISABLE_BUFFER_DEBUGGING)
# endif // defined(_GLIBCXX_DEBUG)
#endif // defined(__GNUC__)
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
# include "asio/detail/push_options.hpp"
# include <boost/function.hpp>
# include "asio/detail/pop_options.hpp"
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
namespace asio {
class mutable_buffer;
@ -61,6 +83,21 @@ public:
{
}
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
mutable_buffer(void* data, std::size_t size,
boost::function<void()> debug_check)
: data_(data),
size_(size),
debug_check_(debug_check)
{
}
const boost::function<void()>& get_debug_check() const
{
return debug_check_;
}
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
private:
friend void* asio::detail::buffer_cast_helper(
const mutable_buffer& b);
@ -69,12 +106,20 @@ private:
void* data_;
std::size_t size_;
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
boost::function<void()> debug_check_;
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
};
namespace detail {
inline void* buffer_cast_helper(const mutable_buffer& b)
{
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
if (b.size_ && b.debug_check_)
b.debug_check_();
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
return b.data_;
}
@ -89,10 +134,10 @@ inline std::size_t buffer_size_helper(const mutable_buffer& b)
/**
* @relates mutable_buffer
*/
template <typename Pointer_To_Pod_Type>
inline Pointer_To_Pod_Type buffer_cast(const mutable_buffer& b)
template <typename PointerToPodType>
inline PointerToPodType buffer_cast(const mutable_buffer& b)
{
return static_cast<Pointer_To_Pod_Type>(detail::buffer_cast_helper(b));
return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
}
/// Get the number of bytes in a non-modifiable buffer.
@ -114,7 +159,11 @@ inline mutable_buffer operator+(const mutable_buffer& b, std::size_t start)
return mutable_buffer();
char* new_data = buffer_cast<char*>(b) + start;
std::size_t new_size = buffer_size(b) - start;
return mutable_buffer(new_data, new_size);
return mutable_buffer(new_data, new_size
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, b.get_debug_check()
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
);
}
/// Create a new modifiable buffer that is offset from the start of another.
@ -127,12 +176,16 @@ inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b)
return mutable_buffer();
char* new_data = buffer_cast<char*>(b) + start;
std::size_t new_size = buffer_size(b) - start;
return mutable_buffer(new_data, new_size);
return mutable_buffer(new_data, new_size
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, b.get_debug_check()
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
);
}
/// Adapts a single modifiable buffer so that it meets the requirements of the
/// Mutable_Buffers concept.
class mutable_buffer_container_1
/// MutableBufferSequence concept.
class mutable_buffers_1
: public mutable_buffer
{
public:
@ -143,7 +196,7 @@ public:
typedef const mutable_buffer* const_iterator;
/// Construct to represent a single modifiable buffer.
explicit mutable_buffer_container_1(const mutable_buffer& b)
explicit mutable_buffers_1(const mutable_buffer& b)
: mutable_buffer(b)
{
}
@ -188,9 +241,27 @@ public:
const_buffer(const mutable_buffer& b)
: data_(asio::detail::buffer_cast_helper(b)),
size_(asio::detail::buffer_size_helper(b))
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, debug_check_(b.get_debug_check())
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
{
}
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
const_buffer(const void* data, std::size_t size,
boost::function<void()> debug_check)
: data_(data),
size_(size),
debug_check_(debug_check)
{
}
const boost::function<void()>& get_debug_check() const
{
return debug_check_;
}
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
private:
friend const void* asio::detail::buffer_cast_helper(
const const_buffer& b);
@ -199,12 +270,20 @@ private:
const void* data_;
std::size_t size_;
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
boost::function<void()> debug_check_;
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
};
namespace detail {
inline const void* buffer_cast_helper(const const_buffer& b)
{
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
if (b.size_ && b.debug_check_)
b.debug_check_();
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
return b.data_;
}
@ -219,10 +298,10 @@ inline std::size_t buffer_size_helper(const const_buffer& b)
/**
* @relates const_buffer
*/
template <typename Pointer_To_Pod_Type>
inline Pointer_To_Pod_Type buffer_cast(const const_buffer& b)
template <typename PointerToPodType>
inline PointerToPodType buffer_cast(const const_buffer& b)
{
return static_cast<Pointer_To_Pod_Type>(detail::buffer_cast_helper(b));
return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
}
/// Get the number of bytes in a non-modifiable buffer.
@ -244,7 +323,11 @@ inline const_buffer operator+(const const_buffer& b, std::size_t start)
return const_buffer();
const char* new_data = buffer_cast<const char*>(b) + start;
std::size_t new_size = buffer_size(b) - start;
return const_buffer(new_data, new_size);
return const_buffer(new_data, new_size
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, b.get_debug_check()
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
);
}
/// Create a new non-modifiable buffer that is offset from the start of another.
@ -257,12 +340,16 @@ inline const_buffer operator+(std::size_t start, const const_buffer& b)
return const_buffer();
const char* new_data = buffer_cast<const char*>(b) + start;
std::size_t new_size = buffer_size(b) - start;
return const_buffer(new_data, new_size);
return const_buffer(new_data, new_size
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, b.get_debug_check()
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
);
}
/// Adapts a single non-modifiable buffer so that it meets the requirements of
/// the Const_Buffers concept.
class const_buffer_container_1
/// the ConstBufferSequence concept.
class const_buffers_1
: public const_buffer
{
public:
@ -273,7 +360,7 @@ public:
typedef const const_buffer* const_iterator;
/// Construct to represent a single non-modifiable buffer.
explicit const_buffer_container_1(const const_buffer& b)
explicit const_buffers_1(const const_buffer& b)
: const_buffer(b)
{
}
@ -291,6 +378,35 @@ public:
}
};
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
namespace detail {
template <typename Iterator>
class buffer_debug_check
{
public:
buffer_debug_check(Iterator iter)
: iter_(iter)
{
}
~buffer_debug_check()
{
iter_ = Iterator();
}
void operator()()
{
*iter_;
}
private:
Iterator iter_;
};
} // namespace detail
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
/** @defgroup buffer asio::buffer
*
* @brief The asio::buffer function is used to create a buffer object to
@ -302,9 +418,9 @@ public:
* @code sock.write(asio::buffer(data, size)); @endcode
*
* In the above example, the return value of asio::buffer meets the
* requirements of the Const_Buffers concept so that it may be directly passed
* to the socket's write function. A buffer created for modifiable memory also
* meets the requirements of the Mutable_Buffers concept.
* requirements of the ConstBufferSequence concept so that it may be directly
* passed to the socket's write function. A buffer created for modifiable
* memory also meets the requirements of the MutableBufferSequence concept.
*
* An individual buffer may be created from a builtin array, std::vector or
* boost::array of POD elements. This helps prevent buffer overruns by
@ -321,7 +437,7 @@ public:
*
* To read or write using multiple buffers (i.e. scatter-gather I/O), multiple
* buffer objects may be assigned into a container that supports the
* Mutable_Buffers (for read) or Const_Buffers (for write) concepts:
* MutableBufferSequence (for read) or ConstBufferSequence (for write) concepts:
*
* @code
* char d1[128];
@ -343,99 +459,108 @@ public:
/*@{*/
/// Create a new modifiable buffer from an existing buffer.
inline mutable_buffer_container_1 buffer(const mutable_buffer& b)
inline mutable_buffers_1 buffer(const mutable_buffer& b)
{
return mutable_buffer_container_1(b);
return mutable_buffers_1(b);
}
/// Create a new modifiable buffer from an existing buffer.
inline mutable_buffer_container_1 buffer(const mutable_buffer& b,
inline mutable_buffers_1 buffer(const mutable_buffer& b,
std::size_t max_size_in_bytes)
{
return mutable_buffer_container_1(
return mutable_buffers_1(
mutable_buffer(buffer_cast<void*>(b),
buffer_size(b) < max_size_in_bytes
? buffer_size(b) : max_size_in_bytes));
? buffer_size(b) : max_size_in_bytes
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, b.get_debug_check()
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/// Create a new non-modifiable buffer from an existing buffer.
inline const_buffer_container_1 buffer(const const_buffer& b)
inline const_buffers_1 buffer(const const_buffer& b)
{
return const_buffer_container_1(b);
return const_buffers_1(b);
}
/// Create a new non-modifiable buffer from an existing buffer.
inline const_buffer_container_1 buffer(const const_buffer& b,
inline const_buffers_1 buffer(const const_buffer& b,
std::size_t max_size_in_bytes)
{
return const_buffer_container_1(
return const_buffers_1(
const_buffer(buffer_cast<const void*>(b),
buffer_size(b) < max_size_in_bytes
? buffer_size(b) : max_size_in_bytes));
? buffer_size(b) : max_size_in_bytes
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, b.get_debug_check()
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/// Create a new modifiable buffer that represents the given memory range.
inline mutable_buffer_container_1 buffer(void* data, std::size_t size_in_bytes)
inline mutable_buffers_1 buffer(void* data, std::size_t size_in_bytes)
{
return mutable_buffer_container_1(mutable_buffer(data, size_in_bytes));
return mutable_buffers_1(mutable_buffer(data, size_in_bytes));
}
/// Create a new non-modifiable buffer that represents the given memory range.
inline const_buffer_container_1 buffer(const void* data,
inline const_buffers_1 buffer(const void* data,
std::size_t size_in_bytes)
{
return const_buffer_container_1(const_buffer(data, size_in_bytes));
return const_buffers_1(const_buffer(data, size_in_bytes));
}
/// Create a new modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline mutable_buffer_container_1 buffer(Pod_Type (&data)[N])
template <typename PodType, std::size_t N>
inline mutable_buffers_1 buffer(PodType (&data)[N])
{
return mutable_buffer_container_1(mutable_buffer(data, N * sizeof(Pod_Type)));
return mutable_buffers_1(mutable_buffer(data, N * sizeof(PodType)));
}
/// Create a new modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline mutable_buffer_container_1 buffer(Pod_Type (&data)[N],
template <typename PodType, std::size_t N>
inline mutable_buffers_1 buffer(PodType (&data)[N],
std::size_t max_size_in_bytes)
{
return mutable_buffer_container_1(
return mutable_buffers_1(
mutable_buffer(data,
N * sizeof(Pod_Type) < max_size_in_bytes
? N * sizeof(Pod_Type) : max_size_in_bytes));
N * sizeof(PodType) < max_size_in_bytes
? N * sizeof(PodType) : max_size_in_bytes));
}
/// Create a new non-modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline const_buffer_container_1 buffer(const Pod_Type (&data)[N])
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(const PodType (&data)[N])
{
return const_buffer_container_1(const_buffer(data, N * sizeof(Pod_Type)));
return const_buffers_1(const_buffer(data, N * sizeof(PodType)));
}
/// Create a new non-modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline const_buffer_container_1 buffer(const Pod_Type (&data)[N],
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(const PodType (&data)[N],
std::size_t max_size_in_bytes)
{
return const_buffer_container_1(
return const_buffers_1(
const_buffer(data,
N * sizeof(Pod_Type) < max_size_in_bytes
? N * sizeof(Pod_Type) : max_size_in_bytes));
N * sizeof(PodType) < max_size_in_bytes
? N * sizeof(PodType) : max_size_in_bytes));
}
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) \
|| BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
// Borland C++ thinks the overloads:
// Borland C++ and Sun Studio think the overloads:
//
// unspecified buffer(boost::array<Pod_Type, N>& array ...);
// unspecified buffer(boost::array<PodType, N>& array ...);
//
// and
//
// unspecified buffer(boost::array<const Pod_Type, N>& array ...);
// unspecified buffer(boost::array<const PodType, N>& array ...);
//
// are ambiguous. This will be worked around by using a buffer_types traits
// class that contains typedefs for the appropriate buffer and container
// classes, based on whether Pod_Type is const or non-const.
// classes, based on whether PodType is const or non-const.
namespace detail {
@ -446,109 +571,111 @@ template <>
struct buffer_types_base<false>
{
typedef mutable_buffer buffer_type;
typedef mutable_buffer_container_1 container_type;
typedef mutable_buffers_1 container_type;
};
template <>
struct buffer_types_base<true>
{
typedef const_buffer buffer_type;
typedef const_buffer_container_1 container_type;
typedef const_buffers_1 container_type;
};
template <typename Pod_Type>
template <typename PodType>
struct buffer_types
: public buffer_types_base<boost::is_const<Pod_Type>::value>
: public buffer_types_base<boost::is_const<PodType>::value>
{
};
} // namespace detail
template <typename Pod_Type, std::size_t N>
inline typename detail::buffer_types<Pod_Type>::container_type
buffer(boost::array<Pod_Type, N>& data)
template <typename PodType, std::size_t N>
inline typename detail::buffer_types<PodType>::container_type
buffer(boost::array<PodType, N>& data)
{
typedef typename asio::detail::buffer_types<Pod_Type>::buffer_type
typedef typename asio::detail::buffer_types<PodType>::buffer_type
buffer_type;
typedef typename asio::detail::buffer_types<Pod_Type>::container_type
typedef typename asio::detail::buffer_types<PodType>::container_type
container_type;
return container_type(
buffer_type(data.c_array(), data.size() * sizeof(Pod_Type)));
buffer_type(data.c_array(), data.size() * sizeof(PodType)));
}
template <typename Pod_Type, std::size_t N>
inline typename detail::buffer_types<Pod_Type>::container_type
buffer(boost::array<Pod_Type, N>& data, std::size_t max_size_in_bytes)
template <typename PodType, std::size_t N>
inline typename detail::buffer_types<PodType>::container_type
buffer(boost::array<PodType, N>& data, std::size_t max_size_in_bytes)
{
typedef typename asio::detail::buffer_types<Pod_Type>::buffer_type
typedef typename asio::detail::buffer_types<PodType>::buffer_type
buffer_type;
typedef typename asio::detail::buffer_types<Pod_Type>::container_type
typedef typename asio::detail::buffer_types<PodType>::container_type
container_type;
return container_type(
buffer_type(data.c_array(),
data.size() * sizeof(Pod_Type) < max_size_in_bytes
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes));
}
#else // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
#else // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
// || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
/// Create a new modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline mutable_buffer_container_1 buffer(boost::array<Pod_Type, N>& data)
template <typename PodType, std::size_t N>
inline mutable_buffers_1 buffer(boost::array<PodType, N>& data)
{
return mutable_buffer_container_1(
mutable_buffer(data.c_array(), data.size() * sizeof(Pod_Type)));
return mutable_buffers_1(
mutable_buffer(data.c_array(), data.size() * sizeof(PodType)));
}
/// Create a new modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline mutable_buffer_container_1 buffer(boost::array<Pod_Type, N>& data,
template <typename PodType, std::size_t N>
inline mutable_buffers_1 buffer(boost::array<PodType, N>& data,
std::size_t max_size_in_bytes)
{
return mutable_buffer_container_1(
return mutable_buffers_1(
mutable_buffer(data.c_array(),
data.size() * sizeof(Pod_Type) < max_size_in_bytes
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes));
}
/// Create a new non-modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline const_buffer_container_1 buffer(boost::array<const Pod_Type, N>& data)
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(boost::array<const PodType, N>& data)
{
return const_buffer_container_1(
const_buffer(data.data(), data.size() * sizeof(Pod_Type)));
return const_buffers_1(
const_buffer(data.data(), data.size() * sizeof(PodType)));
}
/// Create a new non-modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline const_buffer_container_1 buffer(boost::array<const Pod_Type, N>& data,
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(boost::array<const PodType, N>& data,
std::size_t max_size_in_bytes)
{
return const_buffer_container_1(
return const_buffers_1(
const_buffer(data.data(),
data.size() * sizeof(Pod_Type) < max_size_in_bytes
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes));
}
#endif // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
#endif // BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
// || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
/// Create a new non-modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data)
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(const boost::array<PodType, N>& data)
{
return const_buffer_container_1(
const_buffer(data.data(), data.size() * sizeof(Pod_Type)));
return const_buffers_1(
const_buffer(data.data(), data.size() * sizeof(PodType)));
}
/// Create a new non-modifiable buffer that represents the given POD array.
template <typename Pod_Type, std::size_t N>
inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data,
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(const boost::array<PodType, N>& data,
std::size_t max_size_in_bytes)
{
return const_buffer_container_1(
return const_buffers_1(
const_buffer(data.data(),
data.size() * sizeof(Pod_Type) < max_size_in_bytes
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes));
}
/// Create a new modifiable buffer that represents the given POD vector.
@ -556,11 +683,17 @@ inline const_buffer_container_1 buffer(const boost::array<Pod_Type, N>& data,
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
template <typename Pod_Type, typename Allocator>
inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data)
template <typename PodType, typename Allocator>
inline mutable_buffers_1 buffer(std::vector<PodType, Allocator>& data)
{
return mutable_buffer_container_1(
mutable_buffer(&data[0], data.size() * sizeof(Pod_Type)));
return mutable_buffers_1(
mutable_buffer(&data[0], data.size() * sizeof(PodType)
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<
typename std::vector<PodType, Allocator>::iterator
>(data.begin())
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/// Create a new modifiable buffer that represents the given POD vector.
@ -568,14 +701,20 @@ inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data)
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
template <typename Pod_Type, typename Allocator>
inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data,
template <typename PodType, typename Allocator>
inline mutable_buffers_1 buffer(std::vector<PodType, Allocator>& data,
std::size_t max_size_in_bytes)
{
return mutable_buffer_container_1(
return mutable_buffers_1(
mutable_buffer(&data[0],
data.size() * sizeof(Pod_Type) < max_size_in_bytes
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<
typename std::vector<PodType, Allocator>::iterator
>(data.begin())
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/// Create a new non-modifiable buffer that represents the given POD vector.
@ -583,12 +722,18 @@ inline mutable_buffer_container_1 buffer(std::vector<Pod_Type, Allocator>& data,
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
template <typename Pod_Type, typename Allocator>
inline const_buffer_container_1 buffer(
const std::vector<Pod_Type, Allocator>& data)
template <typename PodType, typename Allocator>
inline const_buffers_1 buffer(
const std::vector<PodType, Allocator>& data)
{
return const_buffer_container_1(
const_buffer(&data[0], data.size() * sizeof(Pod_Type)));
return const_buffers_1(
const_buffer(&data[0], data.size() * sizeof(PodType)
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<
typename std::vector<PodType, Allocator>::const_iterator
>(data.begin())
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/// Create a new non-modifiable buffer that represents the given POD vector.
@ -596,14 +741,20 @@ inline const_buffer_container_1 buffer(
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
template <typename Pod_Type, typename Allocator>
inline const_buffer_container_1 buffer(
const std::vector<Pod_Type, Allocator>& data, std::size_t max_size_in_bytes)
template <typename PodType, typename Allocator>
inline const_buffers_1 buffer(
const std::vector<PodType, Allocator>& data, std::size_t max_size_in_bytes)
{
return const_buffer_container_1(
return const_buffers_1(
const_buffer(&data[0],
data.size() * sizeof(Pod_Type) < max_size_in_bytes
? data.size() * sizeof(Pod_Type) : max_size_in_bytes));
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<
typename std::vector<PodType, Allocator>::const_iterator
>(data.begin())
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/// Create a new non-modifiable buffer that represents the given string.
@ -611,9 +762,13 @@ inline const_buffer_container_1 buffer(
* @note The buffer is invalidated by any non-const operation called on the
* given string object.
*/
inline const_buffer_container_1 buffer(const std::string& data)
inline const_buffers_1 buffer(const std::string& data)
{
return const_buffer_container_1(const_buffer(data.data(), data.size()));
return const_buffers_1(const_buffer(data.data(), data.size()
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<std::string::const_iterator>(data.begin())
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/// Create a new non-modifiable buffer that represents the given string.
@ -621,13 +776,17 @@ inline const_buffer_container_1 buffer(const std::string& data)
* @note The buffer is invalidated by any non-const operation called on the
* given string object.
*/
inline const_buffer_container_1 buffer(const std::string& data,
inline const_buffers_1 buffer(const std::string& data,
std::size_t max_size_in_bytes)
{
return const_buffer_container_1(
return const_buffers_1(
const_buffer(data.data(),
data.size() < max_size_in_bytes
? data.size() : max_size_in_bytes));
? data.size() : max_size_in_bytes
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<std::string::const_iterator>(data.begin())
#endif // ASIO_ENABLE_BUFFER_DEBUGGING
));
}
/*@}*/

View File

@ -2,7 +2,7 @@
// buffered_read_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -40,13 +40,12 @@ namespace asio {
* The buffered_read_stream class template can be used to add buffering to the
* synchronous and asynchronous read operations of a stream.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Async_Object, Async_Read_Stream, Async_Write_Stream, Error_Source, Stream,
* Sync_Read_Stream, Sync_Write_Stream.
* AsyncReadStream, AsyncWriteStream, Stream, Sync_Read_Stream, SyncWriteStream.
*/
template <typename Stream>
class buffered_read_stream
@ -59,9 +58,6 @@ public:
/// The type of the lowest layer.
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
/// The type used for reporting errors.
typedef typename next_layer_type::error_type error_type;
#if defined(GENERATING_DOCUMENTATION)
/// The default buffer size.
static const std::size_t default_buffer_size = implementation_defined;
@ -97,10 +93,17 @@ public:
return next_layer_.lowest_layer();
}
/// Get the io_service associated with the object.
/// (Deprecated: use get_io_service().) Get the io_service associated with
/// the object.
asio::io_service& io_service()
{
return next_layer_.io_service();
return next_layer_.get_io_service();
}
/// Get the io_service associated with the object.
asio::io_service& get_io_service()
{
return next_layer_.get_io_service();
}
/// Close the stream.
@ -110,33 +113,33 @@ public:
}
/// Close the stream.
template <typename Error_Handler>
void close(Error_Handler error_handler)
asio::error_code close(asio::error_code& ec)
{
next_layer_.close(error_handler);
return next_layer_.close(ec);
}
/// Write the given data to the stream. Returns the number of bytes written.
/// Throws an exception on failure.
template <typename Const_Buffers>
std::size_t write_some(const Const_Buffers& buffers)
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers)
{
return next_layer_.write_some(buffers);
}
/// Write the given data to the stream. Returns the number of bytes written,
/// or 0 if an error occurred and the error handler did not throw.
template <typename Const_Buffers, typename Error_Handler>
std::size_t write_some(const Const_Buffers& buffers,
Error_Handler error_handler)
/// or 0 if an error occurred.
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers,
asio::error_code& ec)
{
return next_layer_.write_some(buffers, error_handler);
return next_layer_.write_some(buffers, ec);
}
/// Start an asynchronous write. The data being written must be valid for the
/// lifetime of the asynchronous operation.
template <typename Const_Buffers, typename Handler>
void async_write_some(const Const_Buffers& buffers, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_write_some(const ConstBufferSequence& buffers,
WriteHandler handler)
{
next_layer_.async_write_some(buffers, handler);
}
@ -157,10 +160,8 @@ public:
}
/// Fill the buffer with some data. Returns the number of bytes placed in the
/// buffer as a result of the operation, or 0 if an error occurred and the
/// error handler did not throw.
template <typename Error_Handler>
std::size_t fill(Error_Handler error_handler)
/// buffer as a result of the operation, or 0 if an error occurred.
std::size_t fill(asio::error_code& ec)
{
detail::buffer_resize_guard<detail::buffered_stream_storage>
resize_guard(storage_);
@ -169,18 +170,18 @@ public:
storage_.resize(previous_size + next_layer_.read_some(buffer(
storage_.data() + previous_size,
storage_.size() - previous_size),
error_handler));
ec));
resize_guard.commit();
return storage_.size() - previous_size;
}
template <typename Handler>
template <typename ReadHandler>
class fill_handler
{
public:
fill_handler(asio::io_service& io_service,
detail::buffered_stream_storage& storage,
std::size_t previous_size, Handler handler)
std::size_t previous_size, ReadHandler handler)
: io_service_(io_service),
storage_(storage),
previous_size_(previous_size),
@ -188,24 +189,24 @@ public:
{
}
template <typename Error>
void operator()(const Error& e, std::size_t bytes_transferred)
void operator()(const asio::error_code& ec,
std::size_t bytes_transferred)
{
storage_.resize(previous_size_ + bytes_transferred);
io_service_.dispatch(detail::bind_handler(
handler_, e, bytes_transferred));
handler_, ec, bytes_transferred));
}
private:
asio::io_service& io_service_;
detail::buffered_stream_storage& storage_;
std::size_t previous_size_;
Handler handler_;
ReadHandler handler_;
};
/// Start an asynchronous fill.
template <typename Handler>
void async_fill(Handler handler)
template <typename ReadHandler>
void async_fill(ReadHandler handler)
{
std::size_t previous_size = storage_.size();
storage_.resize(storage_.capacity());
@ -213,13 +214,14 @@ public:
buffer(
storage_.data() + previous_size,
storage_.size() - previous_size),
fill_handler<Handler>(io_service(), storage_, previous_size, handler));
fill_handler<ReadHandler>(get_io_service(),
storage_, previous_size, handler));
}
/// Read some data from the stream. Returns the number of bytes read. Throws
/// an exception on failure.
template <typename Mutable_Buffers>
std::size_t read_some(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers)
{
if (storage_.empty())
fill();
@ -227,23 +229,24 @@ public:
}
/// Read some data from the stream. Returns the number of bytes read or 0 if
/// an error occurred and the error handler did not throw an exception.
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t read_some(const Mutable_Buffers& buffers,
Error_Handler error_handler)
/// an error occurred.
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers,
asio::error_code& ec)
{
if (storage_.empty() && !fill(error_handler))
ec = asio::error_code();
if (storage_.empty() && !fill(ec))
return 0;
return copy(buffers);
}
template <typename Mutable_Buffers, typename Handler>
template <typename MutableBufferSequence, typename ReadHandler>
class read_some_handler
{
public:
read_some_handler(asio::io_service& io_service,
detail::buffered_stream_storage& storage,
const Mutable_Buffers& buffers, Handler handler)
const MutableBufferSequence& buffers, ReadHandler handler)
: io_service_(io_service),
storage_(storage),
buffers_(buffers),
@ -251,12 +254,12 @@ public:
{
}
void operator()(const error_type& e, std::size_t)
void operator()(const asio::error_code& ec, std::size_t)
{
if (e || storage_.empty())
if (ec || storage_.empty())
{
std::size_t length = 0;
io_service_.dispatch(detail::bind_handler(handler_, e, length));
io_service_.dispatch(detail::bind_handler(handler_, ec, length));
}
else
{
@ -265,8 +268,8 @@ public:
std::size_t bytes_avail = storage_.size();
std::size_t bytes_copied = 0;
typename Mutable_Buffers::const_iterator iter = buffers_.begin();
typename Mutable_Buffers::const_iterator end = buffers_.end();
typename MutableBufferSequence::const_iterator iter = buffers_.begin();
typename MutableBufferSequence::const_iterator end = buffers_.end();
for (; iter != end && bytes_avail > 0; ++iter)
{
std::size_t max_length = buffer_size(*iter);
@ -279,38 +282,40 @@ public:
}
storage_.consume(bytes_copied);
io_service_.dispatch(detail::bind_handler(handler_, e, bytes_copied));
io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied));
}
}
private:
asio::io_service& io_service_;
detail::buffered_stream_storage& storage_;
Mutable_Buffers buffers_;
Handler handler_;
MutableBufferSequence buffers_;
ReadHandler handler_;
};
/// Start an asynchronous read. The buffer into which the data will be read
/// must be valid for the lifetime of the asynchronous operation.
template <typename Mutable_Buffers, typename Handler>
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_read_some(const MutableBufferSequence& buffers,
ReadHandler handler)
{
if (storage_.empty())
{
async_fill(read_some_handler<Mutable_Buffers, Handler>(
io_service(), storage_, buffers, handler));
async_fill(read_some_handler<MutableBufferSequence, ReadHandler>(
get_io_service(), storage_, buffers, handler));
}
else
{
std::size_t length = copy(buffers);
io_service().post(detail::bind_handler(handler, 0, length));
get_io_service().post(detail::bind_handler(
handler, asio::error_code(), length));
}
}
/// Peek at the incoming data on the stream. Returns the number of bytes read.
/// Throws an exception on failure.
template <typename Mutable_Buffers>
std::size_t peek(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t peek(const MutableBufferSequence& buffers)
{
if (storage_.empty())
fill();
@ -318,11 +323,13 @@ public:
}
/// Peek at the incoming data on the stream. Returns the number of bytes read,
/// or 0 if an error occurred and the error handler did not throw.
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t peek(const Mutable_Buffers& buffers, Error_Handler error_handler)
/// or 0 if an error occurred.
template <typename MutableBufferSequence>
std::size_t peek(const MutableBufferSequence& buffers,
asio::error_code& ec)
{
if (storage_.empty() && !fill(error_handler))
ec = asio::error_code();
if (storage_.empty() && !fill(ec))
return 0;
return peek_copy(buffers);
}
@ -334,25 +341,25 @@ public:
}
/// Determine the amount of data that may be read without blocking.
template <typename Error_Handler>
std::size_t in_avail(Error_Handler error_handler)
std::size_t in_avail(asio::error_code& ec)
{
ec = asio::error_code();
return storage_.size();
}
private:
/// Copy data out of the internal buffer to the specified target buffer.
/// Returns the number of bytes copied.
template <typename Mutable_Buffers>
std::size_t copy(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t copy(const MutableBufferSequence& buffers)
{
using namespace std; // For memcpy.
std::size_t bytes_avail = storage_.size();
std::size_t bytes_copied = 0;
typename Mutable_Buffers::const_iterator iter = buffers.begin();
typename Mutable_Buffers::const_iterator end = buffers.end();
typename MutableBufferSequence::const_iterator iter = buffers.begin();
typename MutableBufferSequence::const_iterator end = buffers.end();
for (; iter != end && bytes_avail > 0; ++iter)
{
std::size_t max_length = buffer_size(*iter);
@ -370,16 +377,16 @@ private:
/// Copy data from the internal buffer to the specified target buffer, without
/// removing the data from the internal buffer. Returns the number of bytes
/// copied.
template <typename Mutable_Buffers>
std::size_t peek_copy(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t peek_copy(const MutableBufferSequence& buffers)
{
using namespace std; // For memcpy.
std::size_t bytes_avail = storage_.size();
std::size_t bytes_copied = 0;
typename Mutable_Buffers::const_iterator iter = buffers.begin();
typename Mutable_Buffers::const_iterator end = buffers.end();
typename MutableBufferSequence::const_iterator iter = buffers.begin();
typename MutableBufferSequence::const_iterator end = buffers.end();
for (; iter != end && bytes_avail > 0; ++iter)
{
std::size_t max_length = buffer_size(*iter);

View File

@ -2,7 +2,7 @@
// buffered_read_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// buffered_stream.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -36,13 +36,12 @@ namespace asio {
* The buffered_stream class template can be used to add buffering to the
* synchronous and asynchronous read and write operations of a stream.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Async_Object, Async_Read_Stream, Async_Write_Stream, Error_Source, Stream,
* Sync_Read_Stream, Sync_Write_Stream.
* AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
*/
template <typename Stream>
class buffered_stream
@ -55,9 +54,6 @@ public:
/// The type of the lowest layer.
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
/// The type used for reporting errors.
typedef typename next_layer_type::error_type error_type;
/// Construct, passing the specified argument to initialise the next layer.
template <typename Arg>
explicit buffered_stream(Arg& a)
@ -87,10 +83,17 @@ public:
return stream_impl_.lowest_layer();
}
/// Get the io_service associated with the object.
/// (Deprecated: use get_io_service().) Get the io_service associated with
/// the object.
asio::io_service& io_service()
{
return stream_impl_.io_service();
return stream_impl_.get_io_service();
}
/// Get the io_service associated with the object.
asio::io_service& get_io_service()
{
return stream_impl_.get_io_service();
}
/// Close the stream.
@ -100,10 +103,9 @@ public:
}
/// Close the stream.
template <typename Error_Handler>
void close(Error_Handler error_handler)
asio::error_code close(asio::error_code& ec)
{
stream_impl_.close(error_handler);
return stream_impl_.close(ec);
}
/// Flush all data from the buffer to the next layer. Returns the number of
@ -116,41 +118,41 @@ public:
/// Flush all data from the buffer to the next layer. Returns the number of
/// bytes written to the next layer on the last write operation, or 0 if an
/// error occurred and the error handler did not throw.
template <typename Error_Handler>
std::size_t flush(Error_Handler error_handler)
/// error occurred.
std::size_t flush(asio::error_code& ec)
{
return stream_impl_.next_layer().flush(error_handler);
return stream_impl_.next_layer().flush(ec);
}
/// Start an asynchronous flush.
template <typename Handler>
void async_flush(Handler handler)
template <typename WriteHandler>
void async_flush(WriteHandler handler)
{
return stream_impl_.next_layer().async_flush(handler);
}
/// Write the given data to the stream. Returns the number of bytes written.
/// Throws an exception on failure.
template <typename Const_Buffers>
std::size_t write_some(const Const_Buffers& buffers)
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers)
{
return stream_impl_.write_some(buffers);
}
/// Write the given data to the stream. Returns the number of bytes written,
/// or 0 if an error occurred and the error handler did not throw.
template <typename Const_Buffers, typename Error_Handler>
std::size_t write_some(const Const_Buffers& buffers,
Error_Handler error_handler)
/// or 0 if an error occurred.
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers,
asio::error_code& ec)
{
return stream_impl_.write_some(buffers, error_handler);
return stream_impl_.write_some(buffers, ec);
}
/// Start an asynchronous write. The data being written must be valid for the
/// lifetime of the asynchronous operation.
template <typename Const_Buffers, typename Handler>
void async_write_some(const Const_Buffers& buffers, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_write_some(const ConstBufferSequence& buffers,
WriteHandler handler)
{
stream_impl_.async_write_some(buffers, handler);
}
@ -163,60 +165,60 @@ public:
}
/// Fill the buffer with some data. Returns the number of bytes placed in the
/// buffer as a result of the operation, or 0 if an error occurred and the
/// error handler did not throw.
template <typename Error_Handler>
std::size_t fill(Error_Handler error_handler)
/// buffer as a result of the operation, or 0 if an error occurred.
std::size_t fill(asio::error_code& ec)
{
return stream_impl_.fill(error_handler);
return stream_impl_.fill(ec);
}
/// Start an asynchronous fill.
template <typename Handler>
void async_fill(Handler handler)
template <typename ReadHandler>
void async_fill(ReadHandler handler)
{
stream_impl_.async_fill(handler);
}
/// Read some data from the stream. Returns the number of bytes read. Throws
/// an exception on failure.
template <typename Mutable_Buffers>
std::size_t read_some(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers)
{
return stream_impl_.read_some(buffers);
}
/// Read some data from the stream. Returns the number of bytes read or 0 if
/// an error occurred and the error handler did not throw an exception.
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t read_some(const Mutable_Buffers& buffers,
Error_Handler error_handler)
/// an error occurred.
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers,
asio::error_code& ec)
{
return stream_impl_.read_some(buffers, error_handler);
return stream_impl_.read_some(buffers, ec);
}
/// Start an asynchronous read. The buffer into which the data will be read
/// must be valid for the lifetime of the asynchronous operation.
template <typename Mutable_Buffers, typename Handler>
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_read_some(const MutableBufferSequence& buffers,
ReadHandler handler)
{
stream_impl_.async_read_some(buffers, handler);
}
/// Peek at the incoming data on the stream. Returns the number of bytes read.
/// Throws an exception on failure.
template <typename Mutable_Buffers>
std::size_t peek(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t peek(const MutableBufferSequence& buffers)
{
return stream_impl_.peek(buffers);
}
/// Peek at the incoming data on the stream. Returns the number of bytes read,
/// or 0 if an error occurred and the error handler did not throw.
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t peek(const Mutable_Buffers& buffers, Error_Handler error_handler)
/// or 0 if an error occurred.
template <typename MutableBufferSequence>
std::size_t peek(const MutableBufferSequence& buffers,
asio::error_code& ec)
{
return stream_impl_.peek(buffers, error_handler);
return stream_impl_.peek(buffers, ec);
}
/// Determine the amount of data that may be read without blocking.
@ -226,10 +228,9 @@ public:
}
/// Determine the amount of data that may be read without blocking.
template <typename Error_Handler>
std::size_t in_avail(Error_Handler error_handler)
std::size_t in_avail(asio::error_code& ec)
{
return stream_impl_.in_avail(error_handler);
return stream_impl_.in_avail(ec);
}
private:

View File

@ -2,7 +2,7 @@
// buffered_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// buffered_write_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -41,13 +41,12 @@ namespace asio {
* The buffered_write_stream class template can be used to add buffering to the
* synchronous and asynchronous write operations of a stream.
*
* @par Thread Safety:
* @par Thread Safety
* @e Distinct @e objects: Safe.@n
* @e Shared @e objects: Unsafe.
*
* @par Concepts:
* Async_Object, Async_Read_Stream, Async_Write_Stream, Error_Source, Stream,
* Sync_Read_Stream, Sync_Write_Stream.
* AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
*/
template <typename Stream>
class buffered_write_stream
@ -60,9 +59,6 @@ public:
/// The type of the lowest layer.
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
/// The type used for reporting errors.
typedef typename next_layer_type::error_type error_type;
#if defined(GENERATING_DOCUMENTATION)
/// The default buffer size.
static const std::size_t default_buffer_size = implementation_defined;
@ -98,10 +94,17 @@ public:
return next_layer_.lowest_layer();
}
/// Get the io_service associated with the object.
/// (Deprecated: use get_io_service().) Get the io_service associated with
/// the object.
asio::io_service& io_service()
{
return next_layer_.io_service();
return next_layer_.get_io_service();
}
/// Get the io_service associated with the object.
asio::io_service& get_io_service()
{
return next_layer_.get_io_service();
}
/// Close the stream.
@ -111,10 +114,9 @@ public:
}
/// Close the stream.
template <typename Error_Handler>
void close(Error_Handler error_handler)
asio::error_code close(asio::error_code& ec)
{
next_layer_.close(error_handler);
return next_layer_.close(ec);
}
/// Flush all data from the buffer to the next layer. Returns the number of
@ -130,53 +132,53 @@ public:
/// Flush all data from the buffer to the next layer. Returns the number of
/// bytes written to the next layer on the last write operation, or 0 if an
/// error occurred and the error handler did not throw.
template <typename Error_Handler>
std::size_t flush(Error_Handler error_handler)
/// error occurred.
std::size_t flush(asio::error_code& ec)
{
std::size_t bytes_written = write(next_layer_,
buffer(storage_.data(), storage_.size()),
transfer_all(), error_handler);
transfer_all(), ec);
storage_.consume(bytes_written);
return bytes_written;
}
template <typename Handler>
template <typename WriteHandler>
class flush_handler
{
public:
flush_handler(asio::io_service& io_service,
detail::buffered_stream_storage& storage, Handler handler)
detail::buffered_stream_storage& storage, WriteHandler handler)
: io_service_(io_service),
storage_(storage),
handler_(handler)
{
}
void operator()(const error_type& e, std::size_t bytes_written)
void operator()(const asio::error_code& ec,
std::size_t bytes_written)
{
storage_.consume(bytes_written);
io_service_.dispatch(detail::bind_handler(handler_, e, bytes_written));
io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_written));
}
private:
asio::io_service& io_service_;
detail::buffered_stream_storage& storage_;
Handler handler_;
WriteHandler handler_;
};
/// Start an asynchronous flush.
template <typename Handler>
void async_flush(Handler handler)
template <typename WriteHandler>
void async_flush(WriteHandler handler)
{
async_write(next_layer_, buffer(storage_.data(), storage_.size()),
flush_handler<Handler>(io_service(), storage_, handler));
flush_handler<WriteHandler>(get_io_service(), storage_, handler));
}
/// Write the given data to the stream. Returns the number of bytes written.
/// Throws an exception on failure.
template <typename Const_Buffers>
std::size_t write_some(const Const_Buffers& buffers)
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers)
{
if (storage_.size() == storage_.capacity())
flush();
@ -185,22 +187,23 @@ public:
/// Write the given data to the stream. Returns the number of bytes written,
/// or 0 if an error occurred and the error handler did not throw.
template <typename Const_Buffers, typename Error_Handler>
std::size_t write_some(const Const_Buffers& buffers,
Error_Handler error_handler)
template <typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buffers,
asio::error_code& ec)
{
if (storage_.size() == storage_.capacity() && !flush(error_handler))
ec = asio::error_code();
if (storage_.size() == storage_.capacity() && !flush(ec))
return 0;
return copy(buffers);
}
template <typename Const_Buffers, typename Handler>
template <typename ConstBufferSequence, typename WriteHandler>
class write_some_handler
{
public:
write_some_handler(asio::io_service& io_service,
detail::buffered_stream_storage& storage,
const Const_Buffers& buffers, Handler handler)
const ConstBufferSequence& buffers, WriteHandler handler)
: io_service_(io_service),
storage_(storage),
buffers_(buffers),
@ -208,12 +211,12 @@ public:
{
}
void operator()(const error_type& e, std::size_t)
void operator()(const asio::error_code& ec, std::size_t)
{
if (e)
if (ec)
{
std::size_t length = 0;
io_service_.dispatch(detail::bind_handler(handler_, e, length));
io_service_.dispatch(detail::bind_handler(handler_, ec, length));
}
else
{
@ -223,8 +226,8 @@ public:
std::size_t space_avail = storage_.capacity() - orig_size;
std::size_t bytes_copied = 0;
typename Const_Buffers::const_iterator iter = buffers_.begin();
typename Const_Buffers::const_iterator end = buffers_.end();
typename ConstBufferSequence::const_iterator iter = buffers_.begin();
typename ConstBufferSequence::const_iterator end = buffers_.end();
for (; iter != end && space_avail > 0; ++iter)
{
std::size_t bytes_avail = buffer_size(*iter);
@ -237,73 +240,77 @@ public:
space_avail -= length;
}
io_service_.dispatch(detail::bind_handler(handler_, e, bytes_copied));
io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied));
}
}
private:
asio::io_service& io_service_;
detail::buffered_stream_storage& storage_;
Const_Buffers buffers_;
Handler handler_;
ConstBufferSequence buffers_;
WriteHandler handler_;
};
/// Start an asynchronous write. The data being written must be valid for the
/// lifetime of the asynchronous operation.
template <typename Const_Buffers, typename Handler>
void async_write_some(const Const_Buffers& buffers, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_write_some(const ConstBufferSequence& buffers,
WriteHandler handler)
{
if (storage_.size() == storage_.capacity())
{
async_flush(write_some_handler<Const_Buffers, Handler>(
io_service(), storage_, buffers, handler));
async_flush(write_some_handler<ConstBufferSequence, WriteHandler>(
get_io_service(), storage_, buffers, handler));
}
else
{
std::size_t bytes_copied = copy(buffers);
io_service().post(detail::bind_handler(handler, 0, bytes_copied));
get_io_service().post(detail::bind_handler(
handler, asio::error_code(), bytes_copied));
}
}
/// Read some data from the stream. Returns the number of bytes read. Throws
/// an exception on failure.
template <typename Mutable_Buffers>
std::size_t read_some(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers)
{
return next_layer_.read_some(buffers);
}
/// Read some data from the stream. Returns the number of bytes read or 0 if
/// an error occurred and the error handler did not throw an exception.
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t read_some(const Mutable_Buffers& buffers,
Error_Handler error_handler)
/// an error occurred.
template <typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buffers,
asio::error_code& ec)
{
return next_layer_.read_some(buffers, error_handler);
return next_layer_.read_some(buffers, ec);
}
/// Start an asynchronous read. The buffer into which the data will be read
/// must be valid for the lifetime of the asynchronous operation.
template <typename Mutable_Buffers, typename Handler>
void async_read_some(const Mutable_Buffers& buffers, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_read_some(const MutableBufferSequence& buffers,
ReadHandler handler)
{
next_layer_.async_read_some(buffers, handler);
}
/// Peek at the incoming data on the stream. Returns the number of bytes read.
/// Throws an exception on failure.
template <typename Mutable_Buffers>
std::size_t peek(const Mutable_Buffers& buffers)
template <typename MutableBufferSequence>
std::size_t peek(const MutableBufferSequence& buffers)
{
return next_layer_.peek(buffers);
}
/// Peek at the incoming data on the stream. Returns the number of bytes read,
/// or 0 if an error occurred and the error handler did not throw.
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t peek(const Mutable_Buffers& buffers, Error_Handler error_handler)
/// or 0 if an error occurred.
template <typename MutableBufferSequence>
std::size_t peek(const MutableBufferSequence& buffers,
asio::error_code& ec)
{
return next_layer_.peek(buffers, error_handler);
return next_layer_.peek(buffers, ec);
}
/// Determine the amount of data that may be read without blocking.
@ -313,17 +320,16 @@ public:
}
/// Determine the amount of data that may be read without blocking.
template <typename Error_Handler>
std::size_t in_avail(Error_Handler error_handler)
std::size_t in_avail(asio::error_code& ec)
{
return next_layer_.in_avail(error_handler);
return next_layer_.in_avail(ec);
}
private:
/// Copy data into the internal buffer from the specified source buffer.
/// Returns the number of bytes copied.
template <typename Const_Buffers>
std::size_t copy(const Const_Buffers& buffers)
template <typename ConstBufferSequence>
std::size_t copy(const ConstBufferSequence& buffers)
{
using namespace std; // For memcpy.
@ -331,8 +337,8 @@ private:
std::size_t space_avail = storage_.capacity() - orig_size;
std::size_t bytes_copied = 0;
typename Const_Buffers::const_iterator iter = buffers.begin();
typename Const_Buffers::const_iterator end = buffers.end();
typename ConstBufferSequence::const_iterator iter = buffers.begin();
typename ConstBufferSequence::const_iterator end = buffers.end();
for (; iter != end && space_avail > 0; ++iter)
{
std::size_t bytes_avail = buffer_size(*iter);

View File

@ -2,7 +2,7 @@
// buffered_write_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// completion_condition.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -71,6 +71,28 @@ private:
/// Return a completion condition function object that indicates that a read or
/// write operation should continue until all of the data has been transferred,
/// or until an error occurs.
/**
* This function is used to create an object, of unspecified type, that meets
* CompletionCondition requirements.
*
* @par Example
* Reading until a buffer is full:
* @code
* boost::array<char, 128> buf;
* asio::error_code ec;
* std::size_t n = asio::read(
* sock, asio::buffer(buf),
* asio::transfer_all(), ec);
* if (ec)
* {
* // An error occurred.
* }
* else
* {
* // n == 128
* }
* @endcode
*/
#if defined(GENERATING_DOCUMENTATION)
unspecified transfer_all();
#else
@ -83,6 +105,28 @@ inline detail::transfer_all_t transfer_all()
/// Return a completion condition function object that indicates that a read or
/// write operation should continue until a minimum number of bytes has been
/// transferred, or until an error occurs.
/**
* This function is used to create an object, of unspecified type, that meets
* CompletionCondition requirements.
*
* @par Example
* Reading until a buffer is full or contains at least 64 bytes:
* @code
* boost::array<char, 128> buf;
* asio::error_code ec;
* std::size_t n = asio::read(
* sock, asio::buffer(buf),
* asio::transfer_at_least(64), ec);
* if (ec)
* {
* // An error occurred.
* }
* else
* {
* // n >= 64 && n <= 128
* }
* @endcode
*/
#if defined(GENERATING_DOCUMENTATION)
unspecified transfer_at_least(std::size_t minimum);
#else

View File

@ -2,7 +2,7 @@
// datagram_socket_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -22,10 +22,12 @@
#include <boost/config.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/error.hpp"
#include "asio/io_service.hpp"
#include "asio/detail/epoll_reactor.hpp"
#include "asio/detail/kqueue_reactor.hpp"
#include "asio/detail/select_reactor.hpp"
#include "asio/detail/service_base.hpp"
#include "asio/detail/reactive_socket_service.hpp"
#include "asio/detail/win_iocp_socket_service.hpp"
@ -34,9 +36,18 @@ namespace asio {
/// Default service implementation for a datagram socket.
template <typename Protocol>
class datagram_socket_service
#if defined(GENERATING_DOCUMENTATION)
: public asio::io_service::service
#else
: public asio::detail::service_base<datagram_socket_service<Protocol> >
#endif
{
public:
#if defined(GENERATING_DOCUMENTATION)
/// The unique service identifier.
static asio::io_service::id id;
#endif
/// The protocol type.
typedef Protocol protocol_type;
@ -53,6 +64,9 @@ private:
#elif defined(ASIO_HAS_KQUEUE)
typedef detail::reactive_socket_service<
Protocol, detail::kqueue_reactor<false> > service_impl_type;
#elif defined(ASIO_HAS_DEV_POLL)
typedef detail::reactive_socket_service<
Protocol, detail::dev_poll_reactor<false> > service_impl_type;
#else
typedef detail::reactive_socket_service<
Protocol, detail::select_reactor<false> > service_impl_type;
@ -75,7 +89,8 @@ public:
/// Construct a new datagram socket service for the specified io_service.
explicit datagram_socket_service(asio::io_service& io_service)
: asio::io_service::service(io_service),
: asio::detail::service_base<
datagram_socket_service<Protocol> >(io_service),
service_impl_(asio::use_service<service_impl_type>(io_service))
{
}
@ -98,29 +113,35 @@ public:
}
// Open a new datagram socket implementation.
template <typename Error_Handler>
void open(implementation_type& impl, const protocol_type& protocol,
Error_Handler error_handler)
asio::error_code open(implementation_type& impl,
const protocol_type& protocol, asio::error_code& ec)
{
if (protocol.type() == SOCK_DGRAM)
service_impl_.open(impl, protocol, error_handler);
service_impl_.open(impl, protocol, ec);
else
error_handler(asio::error(asio::error::invalid_argument));
ec = asio::error::invalid_argument;
return ec;
}
/// Assign an existing native socket to a datagram socket.
template <typename Error_Handler>
void assign(implementation_type& impl, const protocol_type& protocol,
const native_type& native_socket, Error_Handler error_handler)
asio::error_code assign(implementation_type& impl,
const protocol_type& protocol, const native_type& native_socket,
asio::error_code& ec)
{
service_impl_.assign(impl, protocol, native_socket, error_handler);
return service_impl_.assign(impl, protocol, native_socket, ec);
}
/// Determine whether the socket is open.
bool is_open(const implementation_type& impl) const
{
return service_impl_.is_open(impl);
}
/// Close a datagram socket implementation.
template <typename Error_Handler>
void close(implementation_type& impl, Error_Handler error_handler)
asio::error_code close(implementation_type& impl,
asio::error_code& ec)
{
service_impl_.close(impl, error_handler);
return service_impl_.close(impl, ec);
}
/// Get the native socket implementation.
@ -130,154 +151,161 @@ public:
}
/// Cancel all asynchronous operations associated with the socket.
template <typename Error_Handler>
void cancel(implementation_type& impl, Error_Handler error_handler)
asio::error_code cancel(implementation_type& impl,
asio::error_code& ec)
{
service_impl_.cancel(impl, error_handler);
return service_impl_.cancel(impl, ec);
}
/// Determine whether the socket is at the out-of-band data mark.
bool at_mark(const implementation_type& impl,
asio::error_code& ec) const
{
return service_impl_.at_mark(impl, ec);
}
/// Determine the number of bytes available for reading.
std::size_t available(const implementation_type& impl,
asio::error_code& ec) const
{
return service_impl_.available(impl, ec);
}
// Bind the datagram socket to the specified local endpoint.
template <typename Error_Handler>
void bind(implementation_type& impl, const endpoint_type& endpoint,
Error_Handler error_handler)
asio::error_code bind(implementation_type& impl,
const endpoint_type& endpoint, asio::error_code& ec)
{
service_impl_.bind(impl, endpoint, error_handler);
return service_impl_.bind(impl, endpoint, ec);
}
/// Connect the datagram socket to the specified endpoint.
template <typename Error_Handler>
void connect(implementation_type& impl, const endpoint_type& peer_endpoint,
Error_Handler error_handler)
asio::error_code connect(implementation_type& impl,
const endpoint_type& peer_endpoint, asio::error_code& ec)
{
service_impl_.connect(impl, peer_endpoint, error_handler);
return service_impl_.connect(impl, peer_endpoint, ec);
}
/// Start an asynchronous connect.
template <typename Handler>
template <typename ConnectHandler>
void async_connect(implementation_type& impl,
const endpoint_type& peer_endpoint, Handler handler)
const endpoint_type& peer_endpoint, ConnectHandler handler)
{
service_impl_.async_connect(impl, peer_endpoint, handler);
}
/// Set a socket option.
template <typename Option, typename Error_Handler>
void set_option(implementation_type& impl, const Option& option,
Error_Handler error_handler)
template <typename SettableSocketOption>
asio::error_code set_option(implementation_type& impl,
const SettableSocketOption& option, asio::error_code& ec)
{
service_impl_.set_option(impl, option, error_handler);
return service_impl_.set_option(impl, option, ec);
}
/// Get a socket option.
template <typename Option, typename Error_Handler>
void get_option(const implementation_type& impl, Option& option,
Error_Handler error_handler) const
template <typename GettableSocketOption>
asio::error_code get_option(const implementation_type& impl,
GettableSocketOption& option, asio::error_code& ec) const
{
service_impl_.get_option(impl, option, error_handler);
return service_impl_.get_option(impl, option, ec);
}
/// Perform an IO control command on the socket.
template <typename IO_Control_Command, typename Error_Handler>
void io_control(implementation_type& impl, IO_Control_Command& command,
Error_Handler error_handler)
template <typename IoControlCommand>
asio::error_code io_control(implementation_type& impl,
IoControlCommand& command, asio::error_code& ec)
{
service_impl_.io_control(impl, command, error_handler);
return service_impl_.io_control(impl, command, ec);
}
/// Get the local endpoint.
template <typename Error_Handler>
endpoint_type local_endpoint(const implementation_type& impl,
Error_Handler error_handler) const
asio::error_code& ec) const
{
endpoint_type endpoint;
service_impl_.get_local_endpoint(impl, endpoint, error_handler);
return endpoint;
return service_impl_.local_endpoint(impl, ec);
}
/// Get the remote endpoint.
template <typename Error_Handler>
endpoint_type remote_endpoint(const implementation_type& impl,
Error_Handler error_handler) const
asio::error_code& ec) const
{
endpoint_type endpoint;
service_impl_.get_remote_endpoint(impl, endpoint, error_handler);
return endpoint;
return service_impl_.remote_endpoint(impl, ec);
}
/// Disable sends or receives on the socket.
template <typename Error_Handler>
void shutdown(implementation_type& impl, socket_base::shutdown_type what,
Error_Handler error_handler)
asio::error_code shutdown(implementation_type& impl,
socket_base::shutdown_type what, asio::error_code& ec)
{
service_impl_.shutdown(impl, what, error_handler);
return service_impl_.shutdown(impl, what, ec);
}
/// Send the given data to the peer.
template <typename Const_Buffers, typename Error_Handler>
std::size_t send(implementation_type& impl, const Const_Buffers& buffers,
socket_base::message_flags flags, Error_Handler error_handler)
template <typename ConstBufferSequence>
std::size_t send(implementation_type& impl,
const ConstBufferSequence& buffers,
socket_base::message_flags flags, asio::error_code& ec)
{
return service_impl_.send(impl, buffers, flags, error_handler);
return service_impl_.send(impl, buffers, flags, ec);
}
/// Start an asynchronous send.
template <typename Const_Buffers, typename Handler>
void async_send(implementation_type& impl, const Const_Buffers& buffers,
socket_base::message_flags flags, Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
socket_base::message_flags flags, WriteHandler handler)
{
service_impl_.async_send(impl, buffers, flags, handler);
}
/// Send a datagram to the specified endpoint.
template <typename Const_Buffers, typename Error_Handler>
std::size_t send_to(implementation_type& impl, const Const_Buffers& buffers,
const endpoint_type& destination, socket_base::message_flags flags,
Error_Handler error_handler)
template <typename ConstBufferSequence>
std::size_t send_to(implementation_type& impl,
const ConstBufferSequence& buffers, const endpoint_type& destination,
socket_base::message_flags flags, asio::error_code& ec)
{
return service_impl_.send_to(impl, buffers, destination, flags,
error_handler);
return service_impl_.send_to(impl, buffers, destination, flags, ec);
}
/// Start an asynchronous send.
template <typename Const_Buffers, typename Handler>
void async_send_to(implementation_type& impl, const Const_Buffers& buffers,
const endpoint_type& destination, socket_base::message_flags flags,
Handler handler)
template <typename ConstBufferSequence, typename WriteHandler>
void async_send_to(implementation_type& impl,
const ConstBufferSequence& buffers, const endpoint_type& destination,
socket_base::message_flags flags, WriteHandler handler)
{
service_impl_.async_send_to(impl, buffers, destination, flags, handler);
}
/// Receive some data from the peer.
template <typename Mutable_Buffers, typename Error_Handler>
std::size_t receive(implementation_type& impl, const Mutable_Buffers& buffers,
socket_base::message_flags flags, Error_Handler error_handler)
template <typename MutableBufferSequence>
std::size_t receive(implementation_type& impl,
const MutableBufferSequence& buffers,
socket_base::message_flags flags, asio::error_code& ec)
{
return service_impl_.receive(impl, buffers, flags, error_handler);
return service_impl_.receive(impl, buffers, flags, ec);
}
/// Start an asynchronous receive.
template <typename Mutable_Buffers, typename Handler>
void async_receive(implementation_type& impl, const Mutable_Buffers& buffers,
socket_base::message_flags flags, Handler handler)
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive(implementation_type& impl,
const MutableBufferSequence& buffers,
socket_base::message_flags flags, ReadHandler handler)
{
service_impl_.async_receive(impl, buffers, flags, handler);
}
/// Receive a datagram with the endpoint of the sender.
template <typename Mutable_Buffers, typename Error_Handler>
template <typename MutableBufferSequence>
std::size_t receive_from(implementation_type& impl,
const Mutable_Buffers& buffers, endpoint_type& sender_endpoint,
socket_base::message_flags flags, Error_Handler error_handler)
const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
socket_base::message_flags flags, asio::error_code& ec)
{
return service_impl_.receive_from(impl, buffers, sender_endpoint, flags,
error_handler);
ec);
}
/// Start an asynchronous receive that will get the endpoint of the sender.
template <typename Mutable_Buffers, typename Handler>
template <typename MutableBufferSequence, typename ReadHandler>
void async_receive_from(implementation_type& impl,
const Mutable_Buffers& buffers, endpoint_type& sender_endpoint,
socket_base::message_flags flags, Handler handler)
const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
socket_base::message_flags flags, ReadHandler handler)
{
service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags,
handler);

View File

@ -2,7 +2,7 @@
// deadline_timer.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// deadline_timer_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -28,18 +28,30 @@
#include "asio/detail/epoll_reactor.hpp"
#include "asio/detail/kqueue_reactor.hpp"
#include "asio/detail/select_reactor.hpp"
#include "asio/detail/service_base.hpp"
#include "asio/detail/win_iocp_io_service.hpp"
namespace asio {
/// Default service implementation for a timer.
template <typename Time_Type,
typename Time_Traits = asio::time_traits<Time_Type> >
template <typename TimeType,
typename TimeTraits = asio::time_traits<TimeType> >
class deadline_timer_service
#if defined(GENERATING_DOCUMENTATION)
: public asio::io_service::service
#else
: public asio::detail::service_base<
deadline_timer_service<TimeType, TimeTraits> >
#endif
{
public:
#if defined(GENERATING_DOCUMENTATION)
/// The unique service identifier.
static asio::io_service::id id;
#endif
/// The time traits type.
typedef Time_Traits traits_type;
typedef TimeTraits traits_type;
/// The time type.
typedef typename traits_type::time_type time_type;
@ -51,13 +63,16 @@ private:
// The type of the platform-specific implementation.
#if defined(ASIO_HAS_IOCP)
typedef detail::deadline_timer_service<
traits_type, detail::select_reactor<true> > service_impl_type;
traits_type, detail::win_iocp_io_service> service_impl_type;
#elif defined(ASIO_HAS_EPOLL)
typedef detail::deadline_timer_service<
traits_type, detail::epoll_reactor<false> > service_impl_type;
#elif defined(ASIO_HAS_KQUEUE)
typedef detail::deadline_timer_service<
traits_type, detail::kqueue_reactor<false> > service_impl_type;
#elif defined(ASIO_HAS_DEV_POLL)
typedef detail::deadline_timer_service<
traits_type, detail::dev_poll_reactor<false> > service_impl_type;
#else
typedef detail::deadline_timer_service<
traits_type, detail::select_reactor<false> > service_impl_type;
@ -73,7 +88,8 @@ public:
/// Construct a new timer service for the specified io_service.
explicit deadline_timer_service(asio::io_service& io_service)
: asio::io_service::service(io_service),
: asio::detail::service_base<
deadline_timer_service<TimeType, TimeTraits> >(io_service),
service_impl_(asio::use_service<service_impl_type>(io_service))
{
}
@ -96,9 +112,9 @@ public:
}
/// Cancel any asynchronous wait operations associated with the timer.
std::size_t cancel(implementation_type& impl)
std::size_t cancel(implementation_type& impl, asio::error_code& ec)
{
return service_impl_.cancel(impl);
return service_impl_.cancel(impl, ec);
}
/// Get the expiry time for the timer as an absolute time.
@ -109,9 +125,9 @@ public:
/// Set the expiry time for the timer as an absolute time.
std::size_t expires_at(implementation_type& impl,
const time_type& expiry_time)
const time_type& expiry_time, asio::error_code& ec)
{
return service_impl_.expires_at(impl, expiry_time);
return service_impl_.expires_at(impl, expiry_time, ec);
}
/// Get the expiry time for the timer relative to now.
@ -122,20 +138,20 @@ public:
/// Set the expiry time for the timer relative to now.
std::size_t expires_from_now(implementation_type& impl,
const duration_type& expiry_time)
const duration_type& expiry_time, asio::error_code& ec)
{
return service_impl_.expires_from_now(impl, expiry_time);
return service_impl_.expires_from_now(impl, expiry_time, ec);
}
// Perform a blocking wait on the timer.
void wait(implementation_type& impl)
void wait(implementation_type& impl, asio::error_code& ec)
{
service_impl_.wait(impl);
service_impl_.wait(impl, ec);
}
// Start an asynchronous wait on the timer.
template <typename Handler>
void async_wait(implementation_type& impl, Handler handler)
template <typename WaitHandler>
void async_wait(implementation_type& impl, WaitHandler handler)
{
service_impl_.async_wait(impl, handler);
}

View File

@ -2,7 +2,7 @@
// bind_handler.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// buffer_resize_guard.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// buffered_stream_storage.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// call_stack.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// const_buffers_iterator.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -29,9 +29,9 @@ namespace asio {
namespace detail {
// A proxy iterator for a sub-range in a list of buffers.
template <typename Const_Buffers>
template <typename ConstBufferSequence>
class const_buffers_iterator
: public boost::iterator_facade<const_buffers_iterator<Const_Buffers>,
: public boost::iterator_facade<const_buffers_iterator<ConstBufferSequence>,
const char, boost::bidirectional_traversal_tag>
{
public:
@ -41,7 +41,8 @@ public:
}
// Create an iterator for the specified position.
const_buffers_iterator(const Const_Buffers& buffers, std::size_t position)
const_buffers_iterator(const ConstBufferSequence& buffers,
std::size_t position)
: begin_(buffers.begin()),
current_(buffers.begin()),
end_(buffers.end()),
@ -107,7 +108,7 @@ private:
return;
}
typename Const_Buffers::const_iterator iter = current_;
typename ConstBufferSequence::const_iterator iter = current_;
while (iter != begin_)
{
--iter;
@ -136,9 +137,9 @@ private:
asio::const_buffer current_buffer_;
std::size_t current_buffer_position_;
typename Const_Buffers::const_iterator begin_;
typename Const_Buffers::const_iterator current_;
typename Const_Buffers::const_iterator end_;
typename ConstBufferSequence::const_iterator begin_;
typename ConstBufferSequence::const_iterator current_;
typename ConstBufferSequence::const_iterator end_;
std::size_t position_;
};

View File

@ -2,7 +2,7 @@
// consuming_buffers.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -32,8 +32,7 @@ template <typename Buffer, typename Buffer_Iterator>
class consuming_buffers_iterator
: public boost::iterator_facade<
consuming_buffers_iterator<Buffer, Buffer_Iterator>,
const Buffer,
boost::forward_traversal_tag>
const Buffer, boost::forward_traversal_tag>
{
public:
// Default constructor creates an end iterator.
@ -47,23 +46,32 @@ public:
consuming_buffers_iterator(bool at_end, const Buffer& first,
Buffer_Iterator begin_remainder, Buffer_Iterator end_remainder)
: at_end_(at_end),
first_(first),
first_(buffer(first, max_size)),
begin_remainder_(begin_remainder),
end_remainder_(end_remainder)
end_remainder_(end_remainder),
offset_(0)
{
}
private:
friend class boost::iterator_core_access;
enum { max_size = 65536 };
void increment()
{
if (!at_end_)
{
if (begin_remainder_ == end_remainder_)
if (begin_remainder_ == end_remainder_
|| offset_ + buffer_size(first_) >= max_size)
{
at_end_ = true;
}
else
first_ = *begin_remainder_++;
{
offset_ += buffer_size(first_);
first_ = buffer(*begin_remainder_++, max_size - offset_);
}
}
}
@ -88,6 +96,7 @@ private:
Buffer first_;
Buffer_Iterator begin_remainder_;
Buffer_Iterator end_remainder_;
std::size_t offset_;
};
// A proxy for a sub-range in a list of buffers.

View File

@ -2,7 +2,7 @@
// deadline_timer_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -27,6 +27,7 @@
#include "asio/io_service.hpp"
#include "asio/detail/bind_handler.hpp"
#include "asio/detail/noncopyable.hpp"
#include "asio/detail/service_base.hpp"
#include "asio/detail/socket_ops.hpp"
#include "asio/detail/socket_types.hpp"
#include "asio/detail/timer_queue.hpp"
@ -36,7 +37,8 @@ namespace detail {
template <typename Time_Traits, typename Timer_Scheduler>
class deadline_timer_service
: public asio::io_service::service
: public asio::detail::service_base<
deadline_timer_service<Time_Traits, Timer_Scheduler> >
{
public:
// The time type.
@ -56,12 +58,19 @@ public:
// Constructor.
deadline_timer_service(asio::io_service& io_service)
: asio::io_service::service(io_service),
: asio::detail::service_base<
deadline_timer_service<Time_Traits, Timer_Scheduler> >(io_service),
scheduler_(asio::use_service<Timer_Scheduler>(io_service))
{
scheduler_.add_timer_queue(timer_queue_);
}
// Destructor.
~deadline_timer_service()
{
scheduler_.remove_timer_queue(timer_queue_);
}
// Destroy all user-defined handler objects owned by the service.
void shutdown_service()
{
@ -77,16 +86,21 @@ public:
// Destroy a timer implementation.
void destroy(implementation_type& impl)
{
cancel(impl);
asio::error_code ec;
cancel(impl, ec);
}
// Cancel any asynchronous wait operations associated with the timer.
std::size_t cancel(implementation_type& impl)
std::size_t cancel(implementation_type& impl, asio::error_code& ec)
{
if (!impl.might_have_pending_waits)
{
ec = asio::error_code();
return 0;
}
std::size_t count = scheduler_.cancel_timer(timer_queue_, &impl);
impl.might_have_pending_waits = false;
ec = asio::error_code();
return count;
}
@ -98,10 +112,11 @@ public:
// Set the expiry time for the timer as an absolute time.
std::size_t expires_at(implementation_type& impl,
const time_type& expiry_time)
const time_type& expiry_time, asio::error_code& ec)
{
std::size_t count = cancel(impl);
std::size_t count = cancel(impl, ec);
impl.expiry = expiry_time;
ec = asio::error_code();
return count;
}
@ -113,13 +128,14 @@ public:
// Set the expiry time for the timer relative to now.
std::size_t expires_from_now(implementation_type& impl,
const duration_type& expiry_time)
const duration_type& expiry_time, asio::error_code& ec)
{
return expires_at(impl, Time_Traits::add(Time_Traits::now(), expiry_time));
return expires_at(impl,
Time_Traits::add(Time_Traits::now(), expiry_time), ec);
}
// Perform a blocking wait on the timer.
void wait(implementation_type& impl)
void wait(implementation_type& impl, asio::error_code& ec)
{
time_type now = Time_Traits::now();
while (Time_Traits::less_than(now, impl.expiry))
@ -129,9 +145,11 @@ public:
::timeval tv;
tv.tv_sec = timeout.total_seconds();
tv.tv_usec = timeout.total_microseconds() % 1000000;
socket_ops::select(0, 0, 0, 0, &tv);
asio::error_code ec;
socket_ops::select(0, 0, 0, 0, &tv, ec);
now = Time_Traits::now();
}
ec = asio::error_code();
}
template <typename Handler>
@ -145,10 +163,9 @@ public:
{
}
void operator()(int result)
void operator()(const asio::error_code& result)
{
asio::error e(result);
io_service_.post(detail::bind_handler(handler_, e));
io_service_.post(detail::bind_handler(handler_, result));
}
private:
@ -163,7 +180,7 @@ public:
{
impl.might_have_pending_waits = true;
scheduler_.schedule_timer(timer_queue_, impl.expiry,
wait_handler<Handler>(io_service(), handler), &impl);
wait_handler<Handler>(this->get_io_service(), handler), &impl);
}
private:

View File

@ -0,0 +1,647 @@
//
// dev_poll_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_DEV_POLL_REACTOR_HPP
#define ASIO_DETAIL_DEV_POLL_REACTOR_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/push_options.hpp"
#include "asio/detail/dev_poll_reactor_fwd.hpp"
#if defined(ASIO_HAS_DEV_POLL)
#include "asio/detail/push_options.hpp"
#include <cstddef>
#include <vector>
#include <boost/config.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/throw_exception.hpp>
#include <sys/devpoll.h>
#include "asio/detail/pop_options.hpp"
#include "asio/error.hpp"
#include "asio/io_service.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/bind_handler.hpp"
#include "asio/detail/hash_map.hpp"
#include "asio/detail/mutex.hpp"
#include "asio/detail/task_io_service.hpp"
#include "asio/detail/thread.hpp"
#include "asio/detail/reactor_op_queue.hpp"
#include "asio/detail/select_interrupter.hpp"
#include "asio/detail/service_base.hpp"
#include "asio/detail/signal_blocker.hpp"
#include "asio/detail/socket_types.hpp"
#include "asio/detail/timer_queue.hpp"
namespace asio {
namespace detail {
template <bool Own_Thread>
class dev_poll_reactor
: public asio::detail::service_base<dev_poll_reactor<Own_Thread> >
{
public:
// Constructor.
dev_poll_reactor(asio::io_service& io_service)
: asio::detail::service_base<
dev_poll_reactor<Own_Thread> >(io_service),
mutex_(),
dev_poll_fd_(do_dev_poll_create()),
wait_in_progress_(false),
interrupter_(),
read_op_queue_(),
write_op_queue_(),
except_op_queue_(),
pending_cancellations_(),
stop_thread_(false),
thread_(0),
shutdown_(false)
{
// Start the reactor's internal thread only if needed.
if (Own_Thread)
{
asio::detail::signal_blocker sb;
thread_ = new asio::detail::thread(
bind_handler(&dev_poll_reactor::call_run_thread, this));
}
// Add the interrupter's descriptor to /dev/poll.
::pollfd ev = { 0 };
ev.fd = interrupter_.read_descriptor();
ev.events = POLLIN | POLLERR;
ev.revents = 0;
::write(dev_poll_fd_, &ev, sizeof(ev));
}
// Destructor.
~dev_poll_reactor()
{
shutdown_service();
::close(dev_poll_fd_);
}
// Destroy all user-defined handler objects owned by the service.
void shutdown_service()
{
asio::detail::mutex::scoped_lock lock(mutex_);
shutdown_ = true;
stop_thread_ = true;
lock.unlock();
if (thread_)
{
interrupter_.interrupt();
thread_->join();
delete thread_;
thread_ = 0;
}
read_op_queue_.destroy_operations();
write_op_queue_.destroy_operations();
except_op_queue_.destroy_operations();
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
timer_queues_[i]->destroy_timers();
timer_queues_.clear();
}
// Register a socket with the reactor. Returns 0 on success, system error
// code on failure.
int register_descriptor(socket_type descriptor)
{
return 0;
}
// Start a new read operation. The handler object will be invoked when the
// given descriptor is ready to be read, or an error has occurred.
template <typename Handler>
void start_read_op(socket_type descriptor, Handler handler)
{
asio::detail::mutex::scoped_lock lock(mutex_);
if (shutdown_)
return;
if (!read_op_queue_.has_operation(descriptor))
if (handler(asio::error_code()))
return;
if (read_op_queue_.enqueue_operation(descriptor, handler))
{
::pollfd& ev = add_pending_event_change(descriptor);
ev.events = POLLIN | POLLERR | POLLHUP;
if (write_op_queue_.has_operation(descriptor))
ev.events |= POLLOUT;
if (except_op_queue_.has_operation(descriptor))
ev.events |= POLLPRI;
interrupter_.interrupt();
}
}
// Start a new write operation. The handler object will be invoked when the
// given descriptor is ready to be written, or an error has occurred.
template <typename Handler>
void start_write_op(socket_type descriptor, Handler handler)
{
asio::detail::mutex::scoped_lock lock(mutex_);
if (shutdown_)
return;
if (!write_op_queue_.has_operation(descriptor))
if (handler(asio::error_code()))
return;
if (write_op_queue_.enqueue_operation(descriptor, handler))
{
::pollfd& ev = add_pending_event_change(descriptor);
ev.events = POLLOUT | POLLERR | POLLHUP;
if (read_op_queue_.has_operation(descriptor))
ev.events |= POLLIN;
if (except_op_queue_.has_operation(descriptor))
ev.events |= POLLPRI;
interrupter_.interrupt();
}
}
// Start a new exception operation. The handler object will be invoked when
// the given descriptor has exception information, or an error has occurred.
template <typename Handler>
void start_except_op(socket_type descriptor, Handler handler)
{
asio::detail::mutex::scoped_lock lock(mutex_);
if (shutdown_)
return;
if (except_op_queue_.enqueue_operation(descriptor, handler))
{
::pollfd& ev = add_pending_event_change(descriptor);
ev.events = POLLPRI | POLLERR | POLLHUP;
if (read_op_queue_.has_operation(descriptor))
ev.events |= POLLIN;
if (write_op_queue_.has_operation(descriptor))
ev.events |= POLLOUT;
interrupter_.interrupt();
}
}
// Start new write and exception operations. The handler object will be
// invoked when the given descriptor is ready for writing or has exception
// information available, or an error has occurred.
template <typename Handler>
void start_write_and_except_ops(socket_type descriptor, Handler handler)
{
asio::detail::mutex::scoped_lock lock(mutex_);
if (shutdown_)
return;
bool need_mod = write_op_queue_.enqueue_operation(descriptor, handler);
need_mod = except_op_queue_.enqueue_operation(descriptor, handler)
&& need_mod;
if (need_mod)
{
::pollfd& ev = add_pending_event_change(descriptor);
ev.events = POLLOUT | POLLPRI | POLLERR | POLLHUP;
if (read_op_queue_.has_operation(descriptor))
ev.events |= POLLIN;
interrupter_.interrupt();
}
}
// Cancel all operations associated with the given descriptor. The
// handlers associated with the descriptor will be invoked with the
// operation_aborted error.
void cancel_ops(socket_type descriptor)
{
asio::detail::mutex::scoped_lock lock(mutex_);
cancel_ops_unlocked(descriptor);
}
// Enqueue cancellation of all operations associated with the given
// descriptor. The handlers associated with the descriptor will be invoked
// with the operation_aborted error. This function does not acquire the
// dev_poll_reactor's mutex, and so should only be used from within a reactor
// handler.
void enqueue_cancel_ops_unlocked(socket_type descriptor)
{
pending_cancellations_.push_back(descriptor);
}
// Cancel any operations that are running against the descriptor and remove
// its registration from the reactor.
void close_descriptor(socket_type descriptor)
{
asio::detail::mutex::scoped_lock lock(mutex_);
// Remove the descriptor from /dev/poll.
::pollfd& ev = add_pending_event_change(descriptor);
ev.events = POLLREMOVE;
interrupter_.interrupt();
// Cancel any outstanding operations associated with the descriptor.
cancel_ops_unlocked(descriptor);
}
// Add a new timer queue to the reactor.
template <typename Time_Traits>
void add_timer_queue(timer_queue<Time_Traits>& timer_queue)
{
asio::detail::mutex::scoped_lock lock(mutex_);
timer_queues_.push_back(&timer_queue);
}
// Remove a timer queue from the reactor.
template <typename Time_Traits>
void remove_timer_queue(timer_queue<Time_Traits>& timer_queue)
{
asio::detail::mutex::scoped_lock lock(mutex_);
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
{
if (timer_queues_[i] == &timer_queue)
{
timer_queues_.erase(timer_queues_.begin() + i);
return;
}
}
}
// Schedule a timer in the given timer queue to expire at the specified
// absolute time. The handler object will be invoked when the timer expires.
template <typename Time_Traits, typename Handler>
void schedule_timer(timer_queue<Time_Traits>& timer_queue,
const typename Time_Traits::time_type& time, Handler handler, void* token)
{
asio::detail::mutex::scoped_lock lock(mutex_);
if (!shutdown_)
if (timer_queue.enqueue_timer(time, handler, token))
interrupter_.interrupt();
}
// Cancel the timer associated with the given token. Returns the number of
// handlers that have been posted or dispatched.
template <typename Time_Traits>
std::size_t cancel_timer(timer_queue<Time_Traits>& timer_queue, void* token)
{
asio::detail::mutex::scoped_lock lock(mutex_);
std::size_t n = timer_queue.cancel_timer(token);
if (n > 0)
interrupter_.interrupt();
return n;
}
private:
friend class task_io_service<dev_poll_reactor<Own_Thread> >;
// Run /dev/poll once until interrupted or events are ready to be dispatched.
void run(bool block)
{
asio::detail::mutex::scoped_lock lock(mutex_);
// Dispatch any operation cancellations that were made while the select
// loop was not running.
read_op_queue_.dispatch_cancellations();
write_op_queue_.dispatch_cancellations();
except_op_queue_.dispatch_cancellations();
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
timer_queues_[i]->dispatch_cancellations();
// Check if the thread is supposed to stop.
if (stop_thread_)
{
cleanup_operations_and_timers(lock);
return;
}
// We can return immediately if there's no work to do and the reactor is
// not supposed to block.
if (!block && read_op_queue_.empty() && write_op_queue_.empty()
&& except_op_queue_.empty() && all_timer_queues_are_empty())
{
cleanup_operations_and_timers(lock);
return;
}
// Write the pending event registration changes to the /dev/poll descriptor.
std::size_t events_size = sizeof(::pollfd) * pending_event_changes_.size();
errno = 0;
int result = ::write(dev_poll_fd_,
&pending_event_changes_[0], events_size);
if (result != static_cast<int>(events_size))
{
for (std::size_t i = 0; i < pending_event_changes_.size(); ++i)
{
int descriptor = pending_event_changes_[i].fd;
asio::error_code ec = asio::error_code(
errno, asio::error::get_system_category());
read_op_queue_.dispatch_all_operations(descriptor, ec);
write_op_queue_.dispatch_all_operations(descriptor, ec);
except_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
pending_event_changes_.clear();
pending_event_change_index_.clear();
int timeout = block ? get_timeout() : 0;
wait_in_progress_ = true;
lock.unlock();
// Block on the /dev/poll descriptor.
::pollfd events[128] = { { 0 } };
::dvpoll dp = { 0 };
dp.dp_fds = events;
dp.dp_nfds = 128;
dp.dp_timeout = timeout;
int num_events = ::ioctl(dev_poll_fd_, DP_POLL, &dp);
lock.lock();
wait_in_progress_ = false;
// Block signals while dispatching operations.
asio::detail::signal_blocker sb;
// Dispatch the waiting events.
for (int i = 0; i < num_events; ++i)
{
int descriptor = events[i].fd;
if (descriptor == interrupter_.read_descriptor())
{
interrupter_.reset();
}
else
{
bool more_reads = false;
bool more_writes = false;
bool more_except = false;
asio::error_code ec;
// Exception operations must be processed first to ensure that any
// out-of-band data is read before normal data.
if (events[i].events & (POLLPRI | POLLERR | POLLHUP))
more_except = except_op_queue_.dispatch_operation(descriptor, ec);
else
more_except = except_op_queue_.has_operation(descriptor);
if (events[i].events & (POLLIN | POLLERR | POLLHUP))
more_reads = read_op_queue_.dispatch_operation(descriptor, ec);
else
more_reads = read_op_queue_.has_operation(descriptor);
if (events[i].events & (POLLOUT | POLLERR | POLLHUP))
more_writes = write_op_queue_.dispatch_operation(descriptor, ec);
else
more_writes = write_op_queue_.has_operation(descriptor);
if ((events[i].events == POLLHUP)
&& !more_except && !more_reads && !more_writes)
{
// If we have only an POLLHUP event and no operations associated
// with the descriptor then we need to delete the descriptor from
// /dev/poll. The poll operation might produce POLLHUP events even
// if they are not specifically requested, so if we do not remove the
// descriptor we can end up in a tight polling loop.
::pollfd ev = { 0 };
ev.fd = descriptor;
ev.events = POLLREMOVE;
ev.revents = 0;
::write(dev_poll_fd_, &ev, sizeof(ev));
}
else
{
::pollfd ev = { 0 };
ev.fd = descriptor;
ev.events = POLLERR | POLLHUP;
if (more_reads)
ev.events |= POLLIN;
if (more_writes)
ev.events |= POLLOUT;
if (more_except)
ev.events |= POLLPRI;
ev.revents = 0;
int result = ::write(dev_poll_fd_, &ev, sizeof(ev));
if (result != sizeof(ev))
{
ec = asio::error_code(errno,
asio::error::get_system_category());
read_op_queue_.dispatch_all_operations(descriptor, ec);
write_op_queue_.dispatch_all_operations(descriptor, ec);
except_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
}
read_op_queue_.dispatch_cancellations();
write_op_queue_.dispatch_cancellations();
except_op_queue_.dispatch_cancellations();
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
{
timer_queues_[i]->dispatch_timers();
timer_queues_[i]->dispatch_cancellations();
}
// Issue any pending cancellations.
for (size_t i = 0; i < pending_cancellations_.size(); ++i)
cancel_ops_unlocked(pending_cancellations_[i]);
pending_cancellations_.clear();
cleanup_operations_and_timers(lock);
}
// Run the select loop in the thread.
void run_thread()
{
asio::detail::mutex::scoped_lock lock(mutex_);
while (!stop_thread_)
{
lock.unlock();
run(true);
lock.lock();
}
}
// Entry point for the select loop thread.
static void call_run_thread(dev_poll_reactor* reactor)
{
reactor->run_thread();
}
// Interrupt the select loop.
void interrupt()
{
interrupter_.interrupt();
}
// Create the /dev/poll file descriptor. Throws an exception if the descriptor
// cannot be created.
static int do_dev_poll_create()
{
int fd = ::open("/dev/poll", O_RDWR);
if (fd == -1)
{
boost::throw_exception(
asio::system_error(
asio::error_code(errno,
asio::error::get_system_category()),
"/dev/poll"));
}
return fd;
}
// Check if all timer queues are empty.
bool all_timer_queues_are_empty() const
{
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
if (!timer_queues_[i]->empty())
return false;
return true;
}
// Get the timeout value for the /dev/poll DP_POLL operation. The timeout
// value is returned as a number of milliseconds. A return value of -1
// indicates that the poll should block indefinitely.
int get_timeout()
{
if (all_timer_queues_are_empty())
return -1;
// By default we will wait no longer than 5 minutes. This will ensure that
// any changes to the system clock are detected after no longer than this.
boost::posix_time::time_duration minimum_wait_duration
= boost::posix_time::minutes(5);
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
{
boost::posix_time::time_duration wait_duration
= timer_queues_[i]->wait_duration();
if (wait_duration < minimum_wait_duration)
minimum_wait_duration = wait_duration;
}
if (minimum_wait_duration > boost::posix_time::time_duration())
{
int milliseconds = minimum_wait_duration.total_milliseconds();
return milliseconds > 0 ? milliseconds : 1;
}
else
{
return 0;
}
}
// Cancel all operations associated with the given descriptor. The do_cancel
// function of the handler objects will be invoked. This function does not
// acquire the dev_poll_reactor's mutex.
void cancel_ops_unlocked(socket_type descriptor)
{
bool interrupt = read_op_queue_.cancel_operations(descriptor);
interrupt = write_op_queue_.cancel_operations(descriptor) || interrupt;
interrupt = except_op_queue_.cancel_operations(descriptor) || interrupt;
if (interrupt)
interrupter_.interrupt();
}
// Clean up operations and timers. We must not hold the lock since the
// destructors may make calls back into this reactor. We make a copy of the
// vector of timer queues since the original may be modified while the lock
// is not held.
void cleanup_operations_and_timers(
asio::detail::mutex::scoped_lock& lock)
{
timer_queues_for_cleanup_ = timer_queues_;
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
for (std::size_t i = 0; i < timer_queues_for_cleanup_.size(); ++i)
timer_queues_for_cleanup_[i]->cleanup_timers();
}
// Add a pending event entry for the given descriptor.
::pollfd& add_pending_event_change(int descriptor)
{
hash_map<int, std::size_t>::iterator iter
= pending_event_change_index_.find(descriptor);
if (iter == pending_event_change_index_.end())
{
std::size_t index = pending_event_changes_.size();
pending_event_changes_.reserve(pending_event_changes_.size() + 1);
pending_event_change_index_.insert(std::make_pair(descriptor, index));
pending_event_changes_.push_back(::pollfd());
pending_event_changes_[index].fd = descriptor;
pending_event_changes_[index].revents = 0;
return pending_event_changes_[index];
}
else
{
return pending_event_changes_[iter->second];
}
}
// Mutex to protect access to internal data.
asio::detail::mutex mutex_;
// The /dev/poll file descriptor.
int dev_poll_fd_;
// Vector of /dev/poll events waiting to be written to the descriptor.
std::vector< ::pollfd> pending_event_changes_;
// Hash map to associate a descriptor with a pending event change index.
hash_map<int, std::size_t> pending_event_change_index_;
// Whether the DP_POLL operation is currently in progress
bool wait_in_progress_;
// The interrupter is used to break a blocking DP_POLL operation.
select_interrupter interrupter_;
// The queue of read operations.
reactor_op_queue<socket_type> read_op_queue_;
// The queue of write operations.
reactor_op_queue<socket_type> write_op_queue_;
// The queue of except operations.
reactor_op_queue<socket_type> except_op_queue_;
// The timer queues.
std::vector<timer_queue_base*> timer_queues_;
// A copy of the timer queues, used when cleaning up timers. The copy is
// stored as a class data member to avoid unnecessary memory allocation.
std::vector<timer_queue_base*> timer_queues_for_cleanup_;
// The descriptors that are pending cancellation.
std::vector<socket_type> pending_cancellations_;
// Does the reactor loop thread need to stop.
bool stop_thread_;
// The thread that is running the reactor loop.
asio::detail::thread* thread_;
// Whether the service has been shut down.
bool shutdown_;
};
} // namespace detail
} // namespace asio
#endif // defined(ASIO_HAS_DEV_POLL)
#include "asio/detail/pop_options.hpp"
#endif // ASIO_DETAIL_DEV_POLL_REACTOR_HPP

View File

@ -0,0 +1,40 @@
//
// dev_poll_reactor_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_DEV_POLL_REACTOR_FWD_HPP
#define ASIO_DETAIL_DEV_POLL_REACTOR_FWD_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/push_options.hpp"
#if !defined(ASIO_DISABLE_DEV_POLL)
#if defined(__sun) // This service is only supported on Solaris.
// Define this to indicate that /dev/poll is supported on the target platform.
#define ASIO_HAS_DEV_POLL 1
namespace asio {
namespace detail {
template <bool Own_Thread>
class dev_poll_reactor;
} // namespace detail
} // namespace asio
#endif // defined(__sun)
#endif // !defined(ASIO_DISABLE_DEV_POLL)
#include "asio/detail/pop_options.hpp"
#endif // ASIO_DETAIL_DEV_POLL_REACTOR_FWD_HPP

View File

@ -2,7 +2,7 @@
// epoll_reactor.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -30,8 +30,9 @@
#include <boost/throw_exception.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/error.hpp"
#include "asio/io_service.hpp"
#include "asio/system_exception.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/bind_handler.hpp"
#include "asio/detail/hash_map.hpp"
#include "asio/detail/mutex.hpp"
@ -39,6 +40,7 @@
#include "asio/detail/thread.hpp"
#include "asio/detail/reactor_op_queue.hpp"
#include "asio/detail/select_interrupter.hpp"
#include "asio/detail/service_base.hpp"
#include "asio/detail/signal_blocker.hpp"
#include "asio/detail/socket_types.hpp"
#include "asio/detail/timer_queue.hpp"
@ -48,12 +50,12 @@ namespace detail {
template <bool Own_Thread>
class epoll_reactor
: public asio::io_service::service
: public asio::detail::service_base<epoll_reactor<Own_Thread> >
{
public:
// Constructor.
epoll_reactor(asio::io_service& io_service)
: asio::io_service::service(io_service),
: asio::detail::service_base<epoll_reactor<Own_Thread> >(io_service),
mutex_(),
epoll_fd_(do_epoll_create()),
wait_in_progress_(false),
@ -139,7 +141,7 @@ public:
return;
if (!read_op_queue_.has_operation(descriptor))
if (handler(0))
if (handler(asio::error_code()))
return;
if (read_op_queue_.enqueue_operation(descriptor, handler))
@ -153,10 +155,13 @@ public:
ev.data.fd = descriptor;
int result = epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev);
if (result != 0 && errno == ENOENT)
result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev);
if (result != 0)
{
int error = errno;
read_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
read_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -172,7 +177,7 @@ public:
return;
if (!write_op_queue_.has_operation(descriptor))
if (handler(0))
if (handler(asio::error_code()))
return;
if (write_op_queue_.enqueue_operation(descriptor, handler))
@ -186,10 +191,13 @@ public:
ev.data.fd = descriptor;
int result = epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev);
if (result != 0 && errno == ENOENT)
result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev);
if (result != 0)
{
int error = errno;
write_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
write_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -215,10 +223,13 @@ public:
ev.data.fd = descriptor;
int result = epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev);
if (result != 0 && errno == ENOENT)
result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev);
if (result != 0)
{
int error = errno;
except_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
except_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -246,11 +257,14 @@ public:
ev.data.fd = descriptor;
int result = epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev);
if (result != 0 && errno == ENOENT)
result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev);
if (result != 0)
{
int error = errno;
write_op_queue_.dispatch_all_operations(descriptor, error);
except_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
write_op_queue_.dispatch_all_operations(descriptor, ec);
except_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -296,6 +310,21 @@ public:
timer_queues_.push_back(&timer_queue);
}
// Remove a timer queue from the reactor.
template <typename Time_Traits>
void remove_timer_queue(timer_queue<Time_Traits>& timer_queue)
{
asio::detail::mutex::scoped_lock lock(mutex_);
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
{
if (timer_queues_[i] == &timer_queue)
{
timer_queues_.erase(timer_queues_.begin() + i);
return;
}
}
}
// Schedule a timer in the given timer queue to expire at the specified
// absolute time. The handler object will be invoked when the timer expires.
template <typename Time_Traits, typename Handler>
@ -314,7 +343,10 @@ public:
std::size_t cancel_timer(timer_queue<Time_Traits>& timer_queue, void* token)
{
asio::detail::mutex::scoped_lock lock(mutex_);
return timer_queue.cancel_timer(token);
std::size_t n = timer_queue.cancel_timer(token);
if (n > 0)
interrupter_.interrupt();
return n;
}
private:
@ -330,16 +362,13 @@ private:
read_op_queue_.dispatch_cancellations();
write_op_queue_.dispatch_cancellations();
except_op_queue_.dispatch_cancellations();
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
timer_queues_[i]->dispatch_cancellations();
// Check if the thread is supposed to stop.
if (stop_thread_)
{
// Clean up operations. We must not hold the lock since the operations may
// make calls back into this reactor.
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
cleanup_operations_and_timers(lock);
return;
}
@ -348,12 +377,7 @@ private:
if (!block && read_op_queue_.empty() && write_op_queue_.empty()
&& except_op_queue_.empty() && all_timer_queues_are_empty())
{
// Clean up operations. We must not hold the lock since the operations may
// make calls back into this reactor.
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
cleanup_operations_and_timers(lock);
return;
}
@ -381,40 +405,42 @@ private:
}
else
{
if (events[i].events & (EPOLLERR | EPOLLHUP))
{
except_op_queue_.dispatch_all_operations(descriptor, 0);
read_op_queue_.dispatch_all_operations(descriptor, 0);
write_op_queue_.dispatch_all_operations(descriptor, 0);
bool more_reads = false;
bool more_writes = false;
bool more_except = false;
asio::error_code ec;
// Exception operations must be processed first to ensure that any
// out-of-band data is read before normal data.
if (events[i].events & (EPOLLPRI | EPOLLERR | EPOLLHUP))
more_except = except_op_queue_.dispatch_operation(descriptor, ec);
else
more_except = except_op_queue_.has_operation(descriptor);
if (events[i].events & (EPOLLIN | EPOLLERR | EPOLLHUP))
more_reads = read_op_queue_.dispatch_operation(descriptor, ec);
else
more_reads = read_op_queue_.has_operation(descriptor);
if (events[i].events & (EPOLLOUT | EPOLLERR | EPOLLHUP))
more_writes = write_op_queue_.dispatch_operation(descriptor, ec);
else
more_writes = write_op_queue_.has_operation(descriptor);
if ((events[i].events == EPOLLHUP)
&& !more_except && !more_reads && !more_writes)
{
// If we have only an EPOLLHUP event and no operations associated
// with the descriptor then we need to delete the descriptor from
// epoll. The epoll_wait system call will produce EPOLLHUP events
// even if they are not specifically requested, so if we do not
// remove the descriptor we can end up in a tight loop of repeated
// calls to epoll_wait.
epoll_event ev = { 0, { 0 } };
ev.events = 0;
ev.data.fd = descriptor;
epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev);
epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev);
}
else
{
bool more_reads = false;
bool more_writes = false;
bool more_except = false;
// Exception operations must be processed first to ensure that any
// out-of-band data is read before normal data.
if (events[i].events & EPOLLPRI)
more_except = except_op_queue_.dispatch_operation(descriptor, 0);
else
more_except = except_op_queue_.has_operation(descriptor);
if (events[i].events & EPOLLIN)
more_reads = read_op_queue_.dispatch_operation(descriptor, 0);
else
more_reads = read_op_queue_.has_operation(descriptor);
if (events[i].events & EPOLLOUT)
more_writes = write_op_queue_.dispatch_operation(descriptor, 0);
else
more_writes = write_op_queue_.has_operation(descriptor);
epoll_event ev = { 0, { 0 } };
ev.events = EPOLLERR | EPOLLHUP;
if (more_reads)
@ -425,12 +451,15 @@ private:
ev.events |= EPOLLPRI;
ev.data.fd = descriptor;
int result = epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev);
if (result != 0 && errno == ENOENT)
result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev);
if (result != 0)
{
int error = errno;
read_op_queue_.dispatch_all_operations(descriptor, error);
write_op_queue_.dispatch_all_operations(descriptor, error);
except_op_queue_.dispatch_all_operations(descriptor, error);
ec = asio::error_code(errno,
asio::error::get_system_category());
read_op_queue_.dispatch_all_operations(descriptor, ec);
write_op_queue_.dispatch_all_operations(descriptor, ec);
except_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -439,19 +468,17 @@ private:
write_op_queue_.dispatch_cancellations();
except_op_queue_.dispatch_cancellations();
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
{
timer_queues_[i]->dispatch_timers();
timer_queues_[i]->dispatch_cancellations();
}
// Issue any pending cancellations.
for (size_t i = 0; i < pending_cancellations_.size(); ++i)
cancel_ops_unlocked(pending_cancellations_[i]);
pending_cancellations_.clear();
// Clean up operations. We must not hold the lock since the operations may
// make calls back into this reactor.
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
cleanup_operations_and_timers(lock);
}
// Run the select loop in the thread.
@ -488,8 +515,11 @@ private:
int fd = epoll_create(epoll_size);
if (fd == -1)
{
system_exception e("epoll", errno);
boost::throw_exception(e);
boost::throw_exception(
asio::system_error(
asio::error_code(errno,
asio::error::get_system_category()),
"epoll"));
}
return fd;
}
@ -526,7 +556,8 @@ private:
if (minimum_wait_duration > boost::posix_time::time_duration())
{
return minimum_wait_duration.total_milliseconds();
int milliseconds = minimum_wait_duration.total_milliseconds();
return milliseconds > 0 ? milliseconds : 1;
}
else
{
@ -546,6 +577,22 @@ private:
interrupter_.interrupt();
}
// Clean up operations and timers. We must not hold the lock since the
// destructors may make calls back into this reactor. We make a copy of the
// vector of timer queues since the original may be modified while the lock
// is not held.
void cleanup_operations_and_timers(
asio::detail::mutex::scoped_lock& lock)
{
timer_queues_for_cleanup_ = timer_queues_;
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
for (std::size_t i = 0; i < timer_queues_for_cleanup_.size(); ++i)
timer_queues_for_cleanup_[i]->cleanup_timers();
}
// Mutex to protect access to internal data.
asio::detail::mutex mutex_;
@ -570,6 +617,10 @@ private:
// The timer queues.
std::vector<timer_queue_base*> timer_queues_;
// A copy of the timer queues, used when cleaning up timers. The copy is
// stored as a class data member to avoid unnecessary memory allocation.
std::vector<timer_queue_base*> timer_queues_for_cleanup_;
// The descriptors that are pending cancellation.
std::vector<socket_type> pending_cancellations_;

View File

@ -2,7 +2,7 @@
// epoll_reactor_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// event.hpp
// ~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// fd_set_adapter.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// handler_alloc_helpers.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// handler_invoke_helpers.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -0,0 +1,219 @@
//
// handler_queue.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_HANDLER_QUEUE_HPP
#define ASIO_DETAIL_HANDLER_QUEUE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/push_options.hpp"
#include "asio/detail/handler_alloc_helpers.hpp"
#include "asio/detail/handler_invoke_helpers.hpp"
#include "asio/detail/noncopyable.hpp"
namespace asio {
namespace detail {
class handler_queue
: private noncopyable
{
public:
// Base class for handlers in the queue.
class handler
: private noncopyable
{
public:
void invoke()
{
invoke_func_(this);
}
void destroy()
{
destroy_func_(this);
}
protected:
typedef void (*invoke_func_type)(handler*);
typedef void (*destroy_func_type)(handler*);
handler(invoke_func_type invoke_func,
destroy_func_type destroy_func)
: next_(0),
invoke_func_(invoke_func),
destroy_func_(destroy_func)
{
}
~handler()
{
}
private:
friend class handler_queue;
handler* next_;
invoke_func_type invoke_func_;
destroy_func_type destroy_func_;
};
// Smart point to manager handler lifetimes.
class scoped_ptr
: private noncopyable
{
public:
explicit scoped_ptr(handler* h)
: handler_(h)
{
}
~scoped_ptr()
{
if (handler_)
handler_->destroy();
}
handler* get() const
{
return handler_;
}
handler* release()
{
handler* tmp = handler_;
handler_ = 0;
return tmp;
}
private:
handler* handler_;
};
// Constructor.
handler_queue()
: front_(0),
back_(0)
{
}
// Wrap a handler to be pushed into the queue.
template <typename Handler>
static handler* wrap(Handler h)
{
// Allocate and construct an object to wrap the handler.
typedef handler_wrapper<Handler> value_type;
typedef handler_alloc_traits<Handler, value_type> alloc_traits;
raw_handler_ptr<alloc_traits> raw_ptr(h);
handler_ptr<alloc_traits> ptr(raw_ptr, h);
return ptr.release();
}
// Get the handler at the front of the queue.
handler* front()
{
return front_;
}
// Pop a handler from the front of the queue.
void pop()
{
if (front_)
{
handler* tmp = front_;
front_ = front_->next_;
if (front_ == 0)
back_ = 0;
tmp->next_= 0;
}
}
// Push a handler on to the back of the queue.
void push(handler* h)
{
h->next_ = 0;
if (back_)
{
back_->next_ = h;
back_ = h;
}
else
{
front_ = back_ = h;
}
}
// Whether the queue is empty.
bool empty() const
{
return front_ == 0;
}
private:
// Template wrapper for handlers.
template <typename Handler>
class handler_wrapper
: public handler
{
public:
handler_wrapper(Handler h)
: handler(
&handler_wrapper<Handler>::do_call,
&handler_wrapper<Handler>::do_destroy),
handler_(h)
{
}
static void do_call(handler* base)
{
// Take ownership of the handler object.
typedef handler_wrapper<Handler> this_type;
this_type* h(static_cast<this_type*>(base));
typedef handler_alloc_traits<Handler, this_type> alloc_traits;
handler_ptr<alloc_traits> ptr(h->handler_, h);
// Make a copy of the handler so that the memory can be deallocated before
// the upcall is made.
Handler handler(h->handler_);
// Free the memory associated with the handler.
ptr.reset();
// Make the upcall.
asio_handler_invoke_helpers::invoke(handler, &handler);
}
static void do_destroy(handler* base)
{
// Take ownership of the handler object.
typedef handler_wrapper<Handler> this_type;
this_type* h(static_cast<this_type*>(base));
typedef handler_alloc_traits<Handler, this_type> alloc_traits;
handler_ptr<alloc_traits> ptr(h->handler_, h);
}
private:
Handler handler_;
};
// The front of the queue.
handler* front_;
// The back of the queue.
handler* back_;
};
} // namespace detail
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // ASIO_DETAIL_HANDLER_QUEUE_HPP

View File

@ -2,7 +2,7 @@
// hash_map.hpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -25,11 +25,23 @@
#include "asio/detail/pop_options.hpp"
#include "asio/detail/noncopyable.hpp"
#include "asio/detail/socket_types.hpp"
namespace asio {
namespace detail {
using boost::hash_value;
template <typename T>
inline std::size_t calculate_hash_value(const T& t)
{
return boost::hash_value(t);
}
#if defined(_WIN64)
inline std::size_t calculate_hash_value(SOCKET s)
{
return static_cast<std::size_t>(s);
}
#endif // defined(_WIN64)
template <typename K, typename V>
class hash_map
@ -37,7 +49,7 @@ class hash_map
{
public:
// The type of a value in the map.
typedef std::pair<const K, V> value_type;
typedef std::pair<K, V> value_type;
// The type of a non-const iterator over the hash map.
typedef typename std::list<value_type>::iterator iterator;
@ -86,7 +98,7 @@ public:
// Find an entry in the map.
iterator find(const K& k)
{
size_t bucket = hash_value(k) % num_buckets;
size_t bucket = calculate_hash_value(k) % num_buckets;
iterator it = buckets_[bucket].first;
if (it == values_.end())
return values_.end();
@ -104,7 +116,7 @@ public:
// Find an entry in the map.
const_iterator find(const K& k) const
{
size_t bucket = hash_value(k) % num_buckets;
size_t bucket = calculate_hash_value(k) % num_buckets;
const_iterator it = buckets_[bucket].first;
if (it == values_.end())
return it;
@ -122,7 +134,7 @@ public:
// Insert a new entry into the map.
std::pair<iterator, bool> insert(const value_type& v)
{
size_t bucket = hash_value(v.first) % num_buckets;
size_t bucket = calculate_hash_value(v.first) % num_buckets;
iterator it = buckets_[bucket].first;
if (it == values_.end())
{
@ -147,7 +159,7 @@ public:
{
assert(it != values_.end());
size_t bucket = hash_value(it->first) % num_buckets;
size_t bucket = calculate_hash_value(it->first) % num_buckets;
bool is_first = (it == buckets_[bucket].first);
bool is_last = (it == buckets_[bucket].last);
if (is_first && is_last)

View File

@ -2,7 +2,7 @@
// io_control.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -90,7 +90,7 @@ public:
// Construct with a specific command value.
bytes_readable(std::size_t value)
: value_(value)
: value_(static_cast<detail::ioctl_arg_type>(value))
{
}

View File

@ -2,7 +2,7 @@
// kqueue_reactor.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -33,14 +33,16 @@
#include <boost/throw_exception.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/error.hpp"
#include "asio/io_service.hpp"
#include "asio/system_exception.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/bind_handler.hpp"
#include "asio/detail/mutex.hpp"
#include "asio/detail/task_io_service.hpp"
#include "asio/detail/thread.hpp"
#include "asio/detail/reactor_op_queue.hpp"
#include "asio/detail/select_interrupter.hpp"
#include "asio/detail/service_base.hpp"
#include "asio/detail/signal_blocker.hpp"
#include "asio/detail/socket_types.hpp"
#include "asio/detail/timer_queue.hpp"
@ -55,12 +57,13 @@ namespace detail {
template <bool Own_Thread>
class kqueue_reactor
: public asio::io_service::service
: public asio::detail::service_base<kqueue_reactor<Own_Thread> >
{
public:
// Constructor.
kqueue_reactor(asio::io_service& io_service)
: asio::io_service::service(io_service),
: asio::detail::service_base<
kqueue_reactor<Own_Thread> >(io_service),
mutex_(),
kqueue_fd_(do_kqueue_create()),
wait_in_progress_(false),
@ -138,7 +141,7 @@ public:
return;
if (!read_op_queue_.has_operation(descriptor))
if (handler(0))
if (handler(asio::error_code()))
return;
if (read_op_queue_.enqueue_operation(descriptor, handler))
@ -147,8 +150,9 @@ public:
EV_SET(&event, descriptor, EVFILT_READ, EV_ADD, 0, 0, 0);
if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
{
int error = errno;
read_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
read_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -164,7 +168,7 @@ public:
return;
if (!write_op_queue_.has_operation(descriptor))
if (handler(0))
if (handler(asio::error_code()))
return;
if (write_op_queue_.enqueue_operation(descriptor, handler))
@ -173,8 +177,9 @@ public:
EV_SET(&event, descriptor, EVFILT_WRITE, EV_ADD, 0, 0, 0);
if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
{
int error = errno;
write_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
write_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -198,8 +203,9 @@ public:
EV_SET(&event, descriptor, EVFILT_READ, EV_ADD, EV_OOBAND, 0, 0);
if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
{
int error = errno;
except_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
except_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -221,8 +227,9 @@ public:
EV_SET(&event, descriptor, EVFILT_WRITE, EV_ADD, 0, 0, 0);
if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
{
int error = errno;
write_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
write_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
@ -235,9 +242,10 @@ public:
EV_SET(&event, descriptor, EVFILT_READ, EV_ADD, EV_OOBAND, 0, 0);
if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
{
int error = errno;
except_op_queue_.dispatch_all_operations(descriptor, error);
write_op_queue_.dispatch_all_operations(descriptor, error);
asio::error_code ec(errno,
asio::error::get_system_category());
except_op_queue_.dispatch_all_operations(descriptor, ec);
write_op_queue_.dispatch_all_operations(descriptor, ec);
}
}
}
@ -285,6 +293,21 @@ public:
timer_queues_.push_back(&timer_queue);
}
// Remove a timer queue from the reactor.
template <typename Time_Traits>
void remove_timer_queue(timer_queue<Time_Traits>& timer_queue)
{
asio::detail::mutex::scoped_lock lock(mutex_);
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
{
if (timer_queues_[i] == &timer_queue)
{
timer_queues_.erase(timer_queues_.begin() + i);
return;
}
}
}
// Schedule a timer in the given timer queue to expire at the specified
// absolute time. The handler object will be invoked when the timer expires.
template <typename Time_Traits, typename Handler>
@ -303,7 +326,10 @@ public:
std::size_t cancel_timer(timer_queue<Time_Traits>& timer_queue, void* token)
{
asio::detail::mutex::scoped_lock lock(mutex_);
return timer_queue.cancel_timer(token);
std::size_t n = timer_queue.cancel_timer(token);
if (n > 0)
interrupter_.interrupt();
return n;
}
private:
@ -319,16 +345,13 @@ private:
read_op_queue_.dispatch_cancellations();
write_op_queue_.dispatch_cancellations();
except_op_queue_.dispatch_cancellations();
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
timer_queues_[i]->dispatch_cancellations();
// Check if the thread is supposed to stop.
if (stop_thread_)
{
// Clean up operations. We must not hold the lock since the operations may
// make calls back into this reactor.
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
cleanup_operations_and_timers(lock);
return;
}
@ -337,12 +360,7 @@ private:
if (!block && read_op_queue_.empty() && write_op_queue_.empty()
&& except_op_queue_.empty() && all_timer_queues_are_empty())
{
// Clean up operations. We must not hold the lock since the operations may
// make calls back into this reactor.
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
cleanup_operations_and_timers(lock);
return;
}
@ -378,21 +396,24 @@ private:
bool more_except = false;
if (events[i].flags & EV_ERROR)
{
int error = events[i].data;
asio::error_code error(
events[i].data, asio::error::get_system_category());
except_op_queue_.dispatch_all_operations(descriptor, error);
read_op_queue_.dispatch_all_operations(descriptor, error);
}
else if (events[i].flags & EV_OOBAND)
{
more_except = except_op_queue_.dispatch_operation(descriptor, 0);
asio::error_code error;
more_except = except_op_queue_.dispatch_operation(descriptor, error);
if (events[i].data > 0)
more_reads = read_op_queue_.dispatch_operation(descriptor, 0);
more_reads = read_op_queue_.dispatch_operation(descriptor, error);
else
more_reads = read_op_queue_.has_operation(descriptor);
}
else
{
more_reads = read_op_queue_.dispatch_operation(descriptor, 0);
asio::error_code error;
more_reads = read_op_queue_.dispatch_operation(descriptor, error);
more_except = except_op_queue_.has_operation(descriptor);
}
@ -406,7 +427,8 @@ private:
EV_SET(&event, descriptor, EVFILT_READ, EV_DELETE, 0, 0, 0);
if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
{
int error = errno;
asio::error_code error(errno,
asio::error::get_system_category());
except_op_queue_.dispatch_all_operations(descriptor, error);
read_op_queue_.dispatch_all_operations(descriptor, error);
}
@ -417,12 +439,14 @@ private:
bool more_writes = false;
if (events[i].flags & EV_ERROR)
{
int error = events[i].data;
asio::error_code error(
events[i].data, asio::error::get_system_category());
write_op_queue_.dispatch_all_operations(descriptor, error);
}
else
{
more_writes = write_op_queue_.dispatch_operation(descriptor, 0);
asio::error_code error;
more_writes = write_op_queue_.dispatch_operation(descriptor, error);
}
// Update the descriptor in the kqueue.
@ -433,7 +457,8 @@ private:
EV_SET(&event, descriptor, EVFILT_WRITE, EV_DELETE, 0, 0, 0);
if (::kevent(kqueue_fd_, &event, 1, 0, 0, 0) == -1)
{
int error = errno;
asio::error_code error(errno,
asio::error::get_system_category());
write_op_queue_.dispatch_all_operations(descriptor, error);
}
}
@ -443,19 +468,17 @@ private:
write_op_queue_.dispatch_cancellations();
except_op_queue_.dispatch_cancellations();
for (std::size_t i = 0; i < timer_queues_.size(); ++i)
{
timer_queues_[i]->dispatch_timers();
timer_queues_[i]->dispatch_cancellations();
}
// Issue any pending cancellations.
for (std::size_t i = 0; i < pending_cancellations_.size(); ++i)
cancel_ops_unlocked(pending_cancellations_[i]);
pending_cancellations_.clear();
// Clean up operations. We must not hold the lock since the operations may
// make calls back into this reactor.
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
cleanup_operations_and_timers(lock);
}
// Run the select loop in the thread.
@ -489,8 +512,11 @@ private:
int fd = kqueue();
if (fd == -1)
{
system_exception e("kqueue", errno);
boost::throw_exception(e);
boost::throw_exception(
asio::system_error(
asio::error_code(errno,
asio::error::get_system_category()),
"kqueue"));
}
return fd;
}
@ -539,7 +565,7 @@ private:
// Cancel all operations associated with the given descriptor. The do_cancel
// function of the handler objects will be invoked. This function does not
// acquire the epoll_reactor's mutex.
// acquire the kqueue_reactor's mutex.
void cancel_ops_unlocked(socket_type descriptor)
{
bool interrupt = read_op_queue_.cancel_operations(descriptor);
@ -549,16 +575,32 @@ private:
interrupter_.interrupt();
}
// Clean up operations and timers. We must not hold the lock since the
// destructors may make calls back into this reactor. We make a copy of the
// vector of timer queues since the original may be modified while the lock
// is not held.
void cleanup_operations_and_timers(
asio::detail::mutex::scoped_lock& lock)
{
timer_queues_for_cleanup_ = timer_queues_;
lock.unlock();
read_op_queue_.cleanup_operations();
write_op_queue_.cleanup_operations();
except_op_queue_.cleanup_operations();
for (std::size_t i = 0; i < timer_queues_for_cleanup_.size(); ++i)
timer_queues_for_cleanup_[i]->cleanup_timers();
}
// Mutex to protect access to internal data.
asio::detail::mutex mutex_;
// The epoll file descriptor.
// The kqueue file descriptor.
int kqueue_fd_;
// Whether the kqueue wait call is currently in progress
bool wait_in_progress_;
// The interrupter is used to break a blocking epoll_wait call.
// The interrupter is used to break a blocking kevent call.
select_interrupter interrupter_;
// The queue of read operations.
@ -573,6 +615,10 @@ private:
// The timer queues.
std::vector<timer_queue_base*> timer_queues_;
// A copy of the timer queues, used when cleaning up timers. The copy is
// stored as a class data member to avoid unnecessary memory allocation.
std::vector<timer_queue_base*> timer_queues_for_cleanup_;
// The descriptors that are pending cancellation.
std::vector<socket_type> pending_cancellations_;

View File

@ -2,7 +2,7 @@
// kqueue_reactor_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying

View File

@ -0,0 +1,59 @@
//
// local_free_on_block_exit.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP
#define ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/push_options.hpp"
#include "asio/detail/push_options.hpp"
#include <boost/config.hpp>
#include "asio/detail/pop_options.hpp"
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
#include "asio/detail/noncopyable.hpp"
#include "asio/detail/socket_types.hpp"
namespace asio {
namespace detail {
class local_free_on_block_exit
: private noncopyable
{
public:
// Constructor blocks all signals for the calling thread.
explicit local_free_on_block_exit(void* p)
: p_(p)
{
}
// Destructor restores the previous signal mask.
~local_free_on_block_exit()
{
::LocalFree(p_);
}
private:
void* p_;
};
} // namespace detail
} // namespace asio
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
#include "asio/detail/pop_options.hpp"
#endif // ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP

View File

@ -2,7 +2,7 @@
// mutex.hpp
// ~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// noncopyable.hpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// null_event.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -43,17 +43,20 @@ public:
}
// Signal the event.
void signal()
template <typename Lock>
void signal(Lock&)
{
}
// Reset the event.
void clear()
template <typename Lock>
void clear(Lock&)
{
}
// Wait for the event to become signalled.
void wait()
template <typename Lock>
void wait(Lock&)
{
}
};

View File

@ -2,7 +2,7 @@
// null_mutex.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// null_signal_blocker.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// null_thread.hpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -28,7 +28,7 @@
#include "asio/detail/pop_options.hpp"
#include "asio/error.hpp"
#include "asio/system_exception.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/noncopyable.hpp"
namespace asio {
@ -42,7 +42,8 @@ public:
template <typename Function>
null_thread(Function f)
{
system_exception e("thread", asio::error::not_supported);
asio::system_error e(
asio::error::operation_not_supported, "thread");
boost::throw_exception(e);
}

View File

@ -2,7 +2,7 @@
// null_tss_ptr.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// old_win_sdk_compat.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -24,9 +24,9 @@
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
// Guess whether we are building against on old Platform SDK.
#if !defined(IPPROTO_IPV6)
#if !defined(IN6ADDR_ANY_INIT)
#define ASIO_HAS_OLD_WIN_SDK 1
#endif // !defined(IPPROTO_IPV6)
#endif // !defined(IN6ADDR_ANY_INIT)
#if defined(ASIO_HAS_OLD_WIN_SDK)
@ -164,6 +164,10 @@ struct addrinfo_emulation
# define IPPROTO_IPV6 41
#endif
#if !defined(IPV6_UNICAST_HOPS)
# define IPV6_UNICAST_HOPS 4
#endif
#if !defined(IPV6_MULTICAST_IF)
# define IPV6_MULTICAST_IF 9
#endif
@ -305,6 +309,11 @@ inline int IN6_IS_ADDR_MC_GLOBAL(const in6_addr_emulation* a)
#endif // defined(ASIO_HAS_OLD_WIN_SDK)
// Even newer Platform SDKs that support IPv6 may not define IPV6_V6ONLY.
#if !defined(IPV6_V6ONLY)
# define IPV6_V6ONLY 27
#endif
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
#include "asio/detail/pop_options.hpp"

View File

@ -2,7 +2,7 @@
// pipe_select_interrupter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -19,6 +19,7 @@
#include "asio/detail/push_options.hpp"
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include "asio/detail/pop_options.hpp"
#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
@ -27,6 +28,8 @@
#include <fcntl.h>
#include "asio/detail/pop_options.hpp"
#include "asio/error.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/socket_types.hpp"
namespace asio {
@ -46,6 +49,13 @@ public:
write_descriptor_ = pipe_fds[1];
::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK);
}
else
{
asio::error_code ec(errno,
asio::error::get_system_category());
asio::system_error e(ec, "pipe_select_interrupter");
boost::throw_exception(e);
}
}
// Destructor.

View File

@ -2,7 +2,7 @@
// pop_options.hpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@ -2,7 +2,7 @@
// posix_event.hpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -24,11 +24,13 @@
#if defined(BOOST_HAS_PTHREADS)
#include "asio/detail/push_options.hpp"
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <pthread.h>
#include "asio/detail/pop_options.hpp"
#include "asio/system_exception.hpp"
#include "asio/error.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/noncopyable.hpp"
namespace asio {
@ -42,18 +44,13 @@ public:
posix_event()
: signalled_(false)
{
int error = ::pthread_mutex_init(&mutex_, 0);
int error = ::pthread_cond_init(&cond_, 0);
if (error != 0)
{
system_exception e("event", error);
boost::throw_exception(e);
}
error = ::pthread_cond_init(&cond_, 0);
if (error != 0)
{
::pthread_mutex_destroy(&mutex_);
system_exception e("event", error);
asio::system_error e(
asio::error_code(error,
asio::error::get_system_category()),
"event");
boost::throw_exception(e);
}
}
@ -62,37 +59,37 @@ public:
~posix_event()
{
::pthread_cond_destroy(&cond_);
::pthread_mutex_destroy(&mutex_);
}
// Signal the event.
void signal()
template <typename Lock>
void signal(Lock& lock)
{
::pthread_mutex_lock(&mutex_); // Ignore EINVAL and EDEADLK.
BOOST_ASSERT(lock.locked());
(void)lock;
signalled_ = true;
::pthread_cond_signal(&cond_); // Ignore EINVAL.
::pthread_mutex_unlock(&mutex_); // Ignore EINVAL and EPERM.
}
// Reset the event.
void clear()
template <typename Lock>
void clear(Lock& lock)
{
::pthread_mutex_lock(&mutex_); // Ignore EINVAL and EDEADLK.
BOOST_ASSERT(lock.locked());
(void)lock;
signalled_ = false;
::pthread_mutex_unlock(&mutex_); // Ignore EINVAL and EPERM.
}
// Wait for the event to become signalled.
void wait()
template <typename Lock>
void wait(Lock& lock)
{
::pthread_mutex_lock(&mutex_); // Ignore EINVAL and EDEADLK.
BOOST_ASSERT(lock.locked());
while (!signalled_)
::pthread_cond_wait(&cond_, &mutex_); // Ignore EINVAL.
::pthread_mutex_unlock(&mutex_); // Ignore EINVAL and EPERM.
::pthread_cond_wait(&cond_, &lock.mutex().mutex_); // Ignore EINVAL.
}
private:
::pthread_mutex_t mutex_;
::pthread_cond_t cond_;
bool signalled_;
};

View File

@ -2,7 +2,7 @@
// posix_fd_set_adapter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -31,6 +31,7 @@ public:
posix_fd_set_adapter()
: max_descriptor_(invalid_socket)
{
using namespace std; // Needed for memset on Solaris.
FD_ZERO(&fd_set_);
}
@ -57,7 +58,7 @@ public:
}
private:
fd_set fd_set_;
mutable fd_set fd_set_;
socket_type max_descriptor_;
};

View File

@ -2,7 +2,7 @@
// posix_mutex.hpp
// ~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2006 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -28,13 +28,16 @@
#include <pthread.h>
#include "asio/detail/pop_options.hpp"
#include "asio/system_exception.hpp"
#include "asio/error.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/noncopyable.hpp"
#include "asio/detail/scoped_lock.hpp"
namespace asio {
namespace detail {
class posix_event;
class posix_mutex
: private noncopyable
{
@ -47,7 +50,10 @@ public:
int error = ::pthread_mutex_init(&mutex_, 0);
if (error != 0)
{
system_exception e("mutex", error);
asio::system_error e(
asio::error_code(error,
asio::error::get_system_category()),
"mutex");
boost::throw_exception(e);
}
}
@ -64,7 +70,10 @@ public:
int error = ::pthread_mutex_lock(&mutex_);
if (error != 0)
{
system_exception e("mutex", error);
asio::system_error e(
asio::error_code(error,
asio::error::get_system_category()),
"mutex");
boost::throw_exception(e);
}
}
@ -75,12 +84,16 @@ public:
int error = ::pthread_mutex_unlock(&mutex_);
if (error != 0)
{
system_exception e("mutex", error);
asio::system_error e(
asio::error_code(error,
asio::error::get_system_category()),
"mutex");
boost::throw_exception(e);
}
}
private:
friend class posix_event;
::pthread_mutex_t mutex_;
};

Some files were not shown because too many files have changed in this diff Show More