From 798efb71833bcb26e113fbf918974ff5ff8e37b7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 30 May 2007 18:41:15 +0000 Subject: [PATCH] report correct num seeds&peers, at long last --- encryption/msgfmt.pyc | Bin 4954 -> 5012 bytes src/deluge_core.cpp | 16 ++++------------ src/interface.py | 3 +++ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/encryption/msgfmt.pyc b/encryption/msgfmt.pyc index 386e797dde9bf4adf2771e9f8f374cbfbfa09bf1..d228148561cb1801970671966c83d5ff1f590771 100644 GIT binary patch literal 5012 zcmb_g-EtdA6+S(Z^)r?nJNDX3cG*lNBvB~KCaHpe2|r7cO&JPjYn;U3tV>KZBYBe1 zj6B`4tu2WQvQNQla7}Sd70A6@=F*tV+eDuqKs73hPp7P}HQ*r8f>`i=?6ky(3boA_ZmkTZ^pYpBy6h zX_Q8JU?T5zoCf*W8$?A` zXu0Xd#)F)|)A3-KM7bxg0fdU3up5@-A)pjp2@tkJjSt@494#EylfB~6NQ`J zY}Q$vBwjz`iNRbNi}qNb@Io{Ato1t3=*oIMaZ#K?7rPD5y$cgXX3kCR0R3~cmV$cX=q-<~cZBJXY8 zGk8%Kfl2&u=OaA&M<_59D=Hg@oZVkf6lE)MTb;Kp}cr zb4C*4tOKILD|GSBVsq^E|;sJWV{0@aQQNx8d}T zXbR^ck{n^pKH9?F<*7r{5}kK>@bS?rnwAN^MZn?w;cWPoE9Ih6npGeco!`N5PsSAH zq6194@c<$xSZ`<8o)Vq3=>Wky#SH*PUl6Gh(rX*j3QZ~(`)y3C#QN2wtke0gSfj^B zJM=}FrY=nvY1*J^lO{EqEYif~)f;_>9$?9&P7{nYXi}Z^)#>E#bii}#v;m`W6mf;G z8(cKFV%R#-BWzIEywt4I+6Kn)?_G`6omw8H4>rtyI+ZTYMb) zHVTP7KQf~{l^E;K?kG^0@TiS6A2Z44n8H3N_-Ny06cS6jvHX$}I=;SI`#v;4jn%*e zj?p;&n9F(5s-x+1#0r?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2t-(0Uw<2XA28x{Hk{m62D7B5Ro1;GNA9k4qD0?IEc-$MMJK^>GU7YKGrpL-RBrjyj}XKx4L0n;Ri-$)yP>`(sW|( zf|}dK*c-2&)72xl=5_wpll2Q64|zu+x^%NVJ_Hr6NVLcWIQ0tsK6v11Kg+rI2tRxQ z4H=%D-d?2uDxATI>Kabk*Yh(Bh|{^lx~-wZtvNMHjA%(=wj^Comc7k#ba9+0%$mk{ zFv%LI?)={n+H2}`Q;sibn&M>3LM(lsXb!K^Rn)p2%iw^-R*XpvAr#1?I- z(32`Ey1^h*NL6&aQE<_XJ9@!dBC}qFn$MY~teTEr*iH#Zbsw;u%#t%(ur zW7(Q2>H&aV)4+|u&IQqEx@GCm5-CDqC1`Jf75#W3gYvZGFbA8H(kh<$3%`^=C-~vT-qMM{qz&PqI z7{CvjVi1SABF3c=+=58)StqsYcL4tpCw@+{M)Da6_j5acN{-tEZ2O!`tKx+tk8`X!cEo z1y$e;hO5E|?cmt~4i2xMS(zQ{)8qvXA`}qe_2@Ehi;dkyUNHb6Tr6xAagKwk+2N|z zBI4yLzThj}f1IsrO7Y`O%VYG_RWJcv&*DBmwf5Wl1*@su=5mJ;%=Gr-g5}X}kCi!^ ze2qBGtYA~sKL1Hus52Qp@FpLY`YBc1#>z+dp9+6=Hhj0=EgwkW4}b>eKM7a$Yw4%n zofE&|-MN{!IMtfR=Gs*CVw(-E*0Y8v%zH1Dfz-hTBn}D`w_H^bhk{>_umrWnv0i_% zT!8`I1wR8v!P?tXpa`^VH!#y;P6vM=(JKC$oX+x%1>cZtg1o&%lk}gMEAD^@I;utV zQj07|uPWn$TEtf%%c=_6G}D-=uqC2TgD^?=_8g9&*Aj peers; t.handle.get_peer_info(peers); - long total_seeds = 0; - long total_peers = 0; - - for (unsigned long i = 0; i < peers.size(); i++) - if (peers[i].seed) - total_seeds++; - else - total_peers++; - return Py_BuildValue("{s:s,s:l,s:l,s:l,s:l,s:f,s:f,s:d,s:f,s:l,s:l,s:s,s:s,s:f,s:d,s:l,s:l,s:l,s:d,s:l,s:l,s:l,s:l,s:l,s:l,s:d,s:d,s:l,s:l}", "name", t.handle.get_torrent_info().name().c_str(), "num_files", t.handle.get_torrent_info().num_files(), @@ -620,8 +611,8 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args) "total_size", double(i.total_size()), "piece_length", long(i.piece_length()), "num_pieces", long(i.num_pieces()), - "total_seeds", total_seeds, - "total_peers", total_peers, + "total_seeds", s.num_complete, + "total_peers", s.num_incomplete, "is_paused", long(t.handle.is_paused()), "is_seed", long(t.handle.is_seed()), "total_wanted", double(s.total_wanted), @@ -773,11 +764,12 @@ static PyObject *torrent_pop_event(PyObject *self, PyObject *args) return NULL; if (handle_exists(handle)) - return Py_BuildValue("{s:i,s:i,s:s,s:s}", + return Py_BuildValue("{s:i,s:i,s:s,s:i,s:s}", "event_type", EVENT_TRACKER, "unique_ID", M_torrents->at(index).unique_ID, "tracker_status", "Announce succeeded", + "num_peers", long(dynamic_cast(popped_alert)->num_peers), "message", a->msg().c_str() ); else { Py_INCREF(Py_None); return Py_None; } diff --git a/src/interface.py b/src/interface.py index 9a3bd716e..63c734714 100644 --- a/src/interface.py +++ b/src/interface.py @@ -609,6 +609,9 @@ class DelugeGTK: ## Call via a timer to update the interface def update(self): + # Tell the core to handle messages (now, so we show their output on this tick) + self.manager.handle_events() + # Make sure that the interface still exists try: tab = self.wtree.get_widget("torrent_info").get_current_page()