Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 412169 | Differences between
and this patch

Collapse All | Expand All

(-)src/daemon/common/commonTypes.ml.orig (-2 / +8 lines)
Lines 212-217 Link Here
212
    let uids = ref [] in
212
    let uids = ref [] in
213
    let name = ref "" in
213
    let name = ref "" in
214
    let size = ref None in
214
    let size = ref None in
215
    let trackers = ref [] in
215
    let each k v =
216
    let each k v =
216
      match String2.split k '.' with
217
      match String2.split k '.' with
217
      | "xt"::_ -> uids := Uid.of_string v :: !uids
218
      | "xt"::_ -> uids := Uid.of_string v :: !uids
Lines 221-227 Link Here
221
      | "xs"::_ -> () (* eXtra source *)
222
      | "xs"::_ -> () (* eXtra source *)
222
      | "mt"::_ -> () (* manifest topic: url or urn, see http://rakjar.de/gnuticles/MAGMA-Specsv22.txt *)
223
      | "mt"::_ -> () (* manifest topic: url or urn, see http://rakjar.de/gnuticles/MAGMA-Specsv22.txt *)
223
      | "kt"::_ -> () (* keywords topic *)
224
      | "kt"::_ -> () (* keywords topic *)
224
      | "tr"::_ -> () (* BT tracker *)
225
      | "tr"::_ -> trackers := Url.decode v :: !trackers
225
      | "x"::_ -> () (* extensions *)
226
      | "x"::_ -> () (* extensions *)
226
(*
227
(*
227
      | _ when v = "" ->
228
      | _ when v = "" ->
Lines 235-241 Link Here
235
      try each k v
236
      try each k v
236
      with exn -> lprintf_nl "MAGNET: field %S=%S, exn %s" k v (Printexc2.to_string exn)
237
      with exn -> lprintf_nl "MAGNET: field %S=%S, exn %s" k v (Printexc2.to_string exn)
237
    ) url.Url.args;
238
    ) url.Url.args;
238
    object method name = !name method size = !size method uids = List.map Uid.to_uid (Uid.expand !uids) end
239
    object
240
      method name = !name
241
      method size = !size
242
      method uids = List.map Uid.to_uid (Uid.expand !uids)
243
      method trackers = !trackers
244
    end
239
  else 
245
  else 
240
    raise Not_found
246
    raise Not_found
241
247
(-)src/networks/bittorrent/bTClients.ml.orig (-85 / +48 lines)
Lines 103-156 Link Here
103
open BTUdpTracker
103
open BTUdpTracker
104
open UdpSocket
104
open UdpSocket
105
105
106
107
(* some stupid temporary copypasta because i couldnt figure out how to import from btinteractive *)
108
(* let hack_op_file_cancel file = *)
109
(*   CommonSwarming.remove_swarmer file.file_swarmer; *)
110
(*   file.file_swarmer <- None; *)
111
(*    (\* forward declarations turned out difficult. wtf?*\) *)
112
(*   (\* file_stop file;*\) *)
113
(*   remove_file file; *)
114
(*   (\*disconnect_clients file;*\) *)
115
(*   (\*remove_all_clients file;*\) *)
116
(*   if Sys.file_exists file.file_torrent_diskname then Sys.remove file.file_torrent_diskname *)
117
118
let load_torrent_string s user group =
119
  if !verbose then lprintf_nl "load_torrent_string";
120
  let file_id, torrent = BTTorrent.decode_torrent s in
121
122
  (* Save the torrent, because we later want to put
123
     it in the seeded directory. *)
124
  let torrent_diskname = CommonFile.concat_file downloads_directory (torrent.torrent_name ^ ".torrent") in
125
  if Sys.file_exists torrent_diskname then
126
    begin
127
      if !verbose then lprintf_nl "load_torrent_string: %s already exists, ignoring" torrent_diskname;
128
      raise (Torrent_already_exists torrent.torrent_name)
129
    end;
130
  File.from_string torrent_diskname s;
131
132
  if !verbose then
133
    lprintf_nl "Starting torrent download with diskname: %s"
134
        torrent_diskname;
135
  let file = new_download file_id torrent torrent_diskname user group in
136
  (* talk_to_tracker file true; TODO stupid fwd declaration issue. OTOH bep9 torrents arent tracker based anyway*)
137
  CommonInteractive.start_download (file_find (file_num file));
138
  file
139
140
let load_torrent_file filename user group =
141
  if !verbose then
142
    lprintf_nl "load_torrent_file %s" filename;
143
  let s = File.to_string filename in
144
  (* Delete the torrent if it is in the downloads dir. because it gets saved
145
     again under the torrent name and we don't want to clutter up this dir. .*)
146
  if Sys.file_exists filename
147
      && (Filename.dirname filename) = downloads_directory then
148
    Sys.remove filename;
149
  ignore (load_torrent_string s user group)
150
(* end copypasta *)
151
152
153
154
let string_of_event = function
106
let string_of_event = function
155
  | READ_DONE -> "READ_DONE"
107
  | READ_DONE -> "READ_DONE"
156
  | WRITE_DONE -> "WRITE_DONE"
108
  | WRITE_DONE -> "WRITE_DONE"
Lines 621-629 Link Here
621
*)
573
*)
622
574
623
let send_bitfield c =
575
let send_bitfield c =
624
  if c.client_file.file_metadata_downloading then
576
  if not c.client_file.file_metadata_downloading then
625
    lprintf_nl "dont send bitmap, we are in metadata state"
626
  else
627
  send_client c (BitField
577
  send_client c (BitField
628
      (
578
      (
629
      match c.client_file.file_swarmer with
579
      match c.client_file.file_swarmer with
Lines 667-673 Link Here
667
  let msg = (B.encode (B.Dictionary [(* "e",B.Int 0L; *)
617
  let msg = (B.encode (B.Dictionary [(* "e",B.Int 0L; *)
668
                                     "m", (B.Dictionary ["ut_metadata", B.Int 1L]);
618
                                     "m", (B.Dictionary ["ut_metadata", B.Int 1L]);
669
                                     (* "metadata_size", B.Int (-1L) *)])) in begin
619
                                     (* "metadata_size", B.Int (-1L) *)])) in begin
670
    lprintf_file_nl (as_file file) "send extended handshake msg %s" msg;
671
    send_client c (Extended (Int64.to_int 0L, msg));
620
    send_client c (Extended (Int64.to_int 0L, msg));
672
  end
621
  end
673
622
Lines 675-681 Link Here
675
  let module B = Bencode in
624
  let module B = Bencode in
676
  let msg = (B.encode (B.Dictionary ["msg_type", B.Int 0L; (* 0 is request subtype*)
625
  let msg = (B.encode (B.Dictionary ["msg_type", B.Int 0L; (* 0 is request subtype*)
677
                                     "piece", B.Int piece; ])) in begin
626
                                     "piece", B.Int piece; ])) in begin
678
    lprintf_file_nl (as_file file) "send extended request for piece:%Ld msgid:%Ld msg:%s" piece c.client_ut_metadata_msg msg;
679
    send_client c (Extended (Int64.to_int c.client_ut_metadata_msg, msg));
627
    send_client c (Extended (Int64.to_int c.client_ut_metadata_msg, msg));
680
  end
628
  end
681
629
Lines 1043-1049 Link Here
1043
  @param msg The message sent by the client
991
  @param msg The message sent by the client
1044
*)
992
*)
1045
and client_to_client c sock msg =
993
and client_to_client c sock msg =
1046
  (* if !verbose_msg_clients then begin *)
994
  if !verbose_msg_clients then begin
1047
      let (ip,port) = (TcpBufferedSocket.peer_addr sock) in
995
      let (ip,port) = (TcpBufferedSocket.peer_addr sock) in
1048
      let (timeout, next) = get_rtimeout sock in
996
      let (timeout, next) = get_rtimeout sock in
1049
      lprintf_nl "CLIENT %d(%s:%d): (%d, %d,%d) Received %s"
997
      lprintf_nl "CLIENT %d(%s:%d): (%d, %d,%d) Received %s"
Lines 1052-1058 Link Here
1052
      (int_of_float timeout)
1000
      (int_of_float timeout)
1053
      (int_of_float next)
1001
      (int_of_float next)
1054
      (TcpMessages.to_string msg);
1002
      (TcpMessages.to_string msg);
1055
    (* end; *)
1003
  end;
1056
1004
1057
  let file = c.client_file in
1005
  let file = c.client_file in
1058
1006
Lines 1154-1164 Link Here
1154
1102
1155
    | BitField p ->
1103
    | BitField p ->
1156
        (*A bitfield is a summary of what a client have*)
1104
        (*A bitfield is a summary of what a client have*)
1157
      lprintf_file_nl (as_file file) "Bitfield message,  metadata state %B" c.client_file.file_metadata_downloading ;
1105
      if !verbose_msg_clients then
1158
      if c.client_file.file_metadata_downloading then
1106
        lprintf_file_nl (as_file file) "Bitfield message,  metadata state %B" c.client_file.file_metadata_downloading;
1159
        lprintf_file_nl (as_file file) "ignoring Bitfield message, we are in metadata state"
1107
      if not c.client_file.file_metadata_downloading then
1160
      else
1161
1162
        begin
1108
        begin
1163
          match c.client_file.file_swarmer with
1109
          match c.client_file.file_swarmer with
1164
            None -> ()
1110
            None -> ()
Lines 1205-1213 Link Here
1205
1151
1206
    | Have n ->
1152
    | Have n ->
1207
        (* A client can send a "Have" without sending a Bitfield *)
1153
        (* A client can send a "Have" without sending a Bitfield *)
1208
        if c.client_file.file_metadata_downloading then
1154
        if not c.client_file.file_metadata_downloading then
1209
          lprintf_file_nl (as_file file)  "ignoring Have message, we are in metadata state"
1210
        else
1211
        begin
1155
        begin
1212
          match c.client_file.file_swarmer with
1156
          match c.client_file.file_swarmer with
1213
            None -> ()
1157
            None -> ()
Lines 1343-1367 Link Here
1343
           this should of course be moved but I dont know where yet.
1287
           this should of course be moved but I dont know where yet.
1344
           also we shouldnt send more than one handshake of course...
1288
           also we shouldnt send more than one handshake of course...
1345
        *)
1289
        *)
1346
        lprintf_file_nl (as_file file) "Got extended msg: %d %s" extmsg payload;
1290
        if !verbose_msg_clients then
1291
          lprintf_file_nl (as_file file) "Got extended msg: %d %s" extmsg (String.escaped payload);
1347
1292
1348
        match extmsg with
1293
        match extmsg with
1349
            0x0 ->
1294
            0x0 ->
1350
            lprintf_file_nl (as_file file) "Got extended handshake ";
1295
            if !verbose_msg_clients then
1296
              lprintf_file_nl (as_file file) "Got extended handshake";
1351
            let dict = Bencode.decode payload in begin
1297
            let dict = Bencode.decode payload in begin
1352
              match dict with
1298
              match dict with
1353
                  Dictionary list ->
1299
                  Dictionary list ->
1354
                    List.iter (fun (key,value) ->
1300
                    List.iter (fun (key,value) ->
1355
                      match key, value with
1301
                      match key, value with
1356
                          "metadata_size", Int n ->
1302
                          "metadata_size", Int n ->
1357
                            lprintf_file_nl (as_file file) "Got metadata size %Ld" n;
1303
                            if !verbose_msg_clients then
1304
                              lprintf_file_nl (as_file file) "Got metadata size %Ld" n;
1358
                            c.client_file.file_metadata_size <- n;
1305
                            c.client_file.file_metadata_size <- n;
1359
                        | "m", Dictionary  mdict ->
1306
                        | "m", Dictionary  mdict ->
1360
                          lprintf_file_nl (as_file file) "Got meta dict ";
1307
                          if !verbose_msg_clients then
1308
                            lprintf_file_nl (as_file file) "Got meta dict";
1361
                          List.iter (fun (key,value) ->
1309
                          List.iter (fun (key,value) ->
1362
                            match key, value with
1310
                            match key, value with
1363
                                "ut_metadata", Int n ->
1311
                                "ut_metadata", Int n ->
1364
                                  lprintf_file_nl (as_file file) "ut_metadata is %Ld " n;
1312
                                  if !verbose_msg_clients then
1313
                                    lprintf_file_nl (as_file file) "ut_metadata is %Ld " n;
1365
                                  c.client_ut_metadata_msg <- n;
1314
                                  c.client_ut_metadata_msg <- n;
1366
                              | _ -> ();
1315
                              | _ -> ();
1367
                          ) mdict;
1316
                          ) mdict;
Lines 1390-1396 Link Here
1390
                       after the dict comes the actual piece
1339
                       after the dict comes the actual piece
1391
                       
1340
                       
1392
                    *)
1341
                    *)
1393
            lprintf_file_nl (as_file file) "Got extended ut_metadata message ";
1342
            if !verbose_msg_clients then
1343
              lprintf_file_nl (as_file file) "Got extended ut_metadata message";
1394
            let dict = Bencode.decode payload in
1344
            let dict = Bencode.decode payload in
1395
            let msgtype = ref 0L in begin
1345
            let msgtype = ref 0L in begin
1396
              begin
1346
              begin
Lines 1399-1411 Link Here
1399
                      List.iter (fun (key,value) ->
1349
                      List.iter (fun (key,value) ->
1400
                        match key, value with
1350
                        match key, value with
1401
                            "msg_type", Int n ->
1351
                            "msg_type", Int n ->
1402
                              lprintf_file_nl (as_file file) "msg_type %Ld" n;
1352
                              if !verbose_msg_clients then
1353
                                lprintf_file_nl (as_file file) "msg_type %Ld" n;
1403
                              msgtype := n;
1354
                              msgtype := n;
1404
                          | "piece", Int n ->
1355
                          | "piece", Int n ->
1405
                            lprintf_file_nl (as_file file) "piece %Ld" n;
1356
                            if !verbose_msg_clients then
1357
                              lprintf_file_nl (as_file file) "piece %Ld" n;
1406
                            file.file_metadata_piece <- n;
1358
                            file.file_metadata_piece <- n;
1407
                          | "total_size", Int n ->
1359
                          | "total_size", Int n ->
1408
                            lprintf_file_nl (as_file file) "total_size %Ld" n; (* should always be the same as received in the initial handshake i suppose *)
1360
                             if !verbose_msg_clients then
1361
                              lprintf_file_nl (as_file file) "total_size %Ld" n; (* should always be the same as received in the initial handshake i suppose *)
1409
                          |_ -> () ;
1362
                          |_ -> () ;
1410
                      ) list;
1363
                      ) list;
1411
                  |_ -> () ;
1364
                  |_ -> () ;
Lines 1413-1430 Link Here
1413
              match !msgtype with
1366
              match !msgtype with
1414
                  1L ->
1367
                  1L ->
1415
                    let last_piece_index = (Int64.div file.file_metadata_size 16384L) in
1368
                    let last_piece_index = (Int64.div file.file_metadata_size 16384L) in
1416
                    lprintf_file_nl (as_file file) "handling metadata piece %Ld of %Ld"
1369
                    if !verbose_msg_clients then
1417
                      file.file_metadata_piece
1370
                      lprintf_file_nl (as_file file) "handling metadata piece %Ld of %Ld"
1418
                      last_piece_index;
1371
                        file.file_metadata_piece
1372
                        last_piece_index;
1419
                        (* store the metadata piece in memory *)
1373
                        (* store the metadata piece in memory *)
1420
                    file.file_metadata_chunks.(1 + (Int64.to_int file.file_metadata_piece)) <- payload;
1374
                    file.file_metadata_chunks.(1 + (Int64.to_int file.file_metadata_piece)) <- payload;
1421
                        (* possibly write metadata to disk *)
1375
                        (* possibly write metadata to disk *)
1422
                    if file.file_metadata_piece >=
1376
                    if file.file_metadata_piece >=
1423
                      (Int64.div file.file_metadata_size 16384L) then begin
1377
                      (Int64.div file.file_metadata_size 16384L) then begin
1424
                        lprintf_file_nl (as_file file) "this was the last piece ";
1378
                        if !verbose_msg_clients then
1379
                          lprintf_file_nl (as_file file) "this was the last piece";
1425
                            (* here we should simply delete the current download, and wait for mld to pick up the new torrent file *)
1380
                            (* here we should simply delete the current download, and wait for mld to pick up the new torrent file *)
1426
                            (* the entire payload is currently in the array, TODO *)
1381
                            (* the entire payload is currently in the array, TODO *)
1427
                        let newtorrentfile = (Printf.sprintf "/tmp/BT-%s.torrent"
1382
                        let newtorrentfile = (Printf.sprintf "%s/BT-%s.torrent"
1383
                                                      (Filename2.temp_dir_name ())
1428
                                                      (Sha1.to_string file.file_id)) in
1384
                                                      (Sha1.to_string file.file_id)) in
1429
                        let fd = Unix32.create_rw  newtorrentfile  in
1385
                        let fd = Unix32.create_rw  newtorrentfile  in
1430
                        let fileindex = ref 0L in
1386
                        let fileindex = ref 0L in
Lines 1447-1485 Link Here
1447
                            ) file.file_metadata_chunks;
1403
                            ) file.file_metadata_chunks;
1448
                          with e -> begin
1404
                          with e -> begin
1449
                            (* TODO ignoring errors for now, the array isnt really set up right anyway yet *)
1405
                            (* TODO ignoring errors for now, the array isnt really set up right anyway yet *)
1406
                            (*
1450
                            lprintf_file_nl (as_file file) "Error %s saving metadata"
1407
                            lprintf_file_nl (as_file file) "Error %s saving metadata"
1451
                              (Printexc2.to_string e)
1408
                              (Printexc2.to_string e)
1409
                            *) ()
1452
                          end;
1410
                          end;
1453
                          (* Yay, now the new torrent is on disk! amazing! However, now we need to kill the dummy torrent
1411
                          (* Yay, now the new torrent is on disk! amazing! However, now we need to kill the dummy torrent
1454
                             and restart it with the fresh real torrent *)
1412
                             and restart it with the fresh real torrent *)
1455
1413
1456
                          (* it seems we need to use the dynamic interface... *)
1414
                          (* it seems we need to use the dynamic interface... *)
1457
                          lprintf_file_nl (as_file file) "cancelling metadata download ";
1415
                          if !verbose then
1416
                            lprintf_file_nl (as_file file) "cancelling metadata download ";
1458
                          let owner = file.file_file.impl_file_owner in
1417
                          let owner = file.file_file.impl_file_owner in
1459
                          let group = file.file_file.impl_file_group in begin
1418
                          let group = file.file_file.impl_file_group in begin
1460
                            CommonInteractive.file_cancel (as_file file) owner ;
1419
                            CommonInteractive.file_cancel (as_file file) owner ;
1461
                            (* hack_op_file_cancel c.client_file;   *)
1420
                            (* hack_op_file_cancel c.client_file;   *)
1462
                            lprintf_file_nl (as_file file) "starting download from metadata torrent %s" newtorrentfile  ;
1421
                            if !verbose then
1463
                            load_torrent_file newtorrentfile owner group;
1422
                              lprintf_file_nl (as_file file) "starting download from metadata torrent %s" newtorrentfile  ;
1423
                            ignore(CommonNetwork.network_parse_url BTGlobals.network newtorrentfile owner group);
1464
                          end;
1424
                          end;
1425
                          (try Sys.remove newtorrentfile with _ -> ())
1465
                        end;
1426
                        end;
1466
                        
1427
1467
                      end
1428
                      end
1468
                    else begin
1429
                    else begin
1469
                          (* now ask for the next metadata piece, if any *)
1430
                          (* now ask for the next metadata piece, if any *)
1470
                      let module B = Bencode in
1431
                      let module B = Bencode in
1471
                      let nextpiece = (Int64.succ file.file_metadata_piece) in begin
1432
                      let nextpiece = (Int64.succ file.file_metadata_piece) in begin
1472
                        lprintf_file_nl (as_file file) "asking for the next piece %Ld" nextpiece;
1433
                        if !verbose_msg_clients then
1434
                          lprintf_file_nl (as_file file) "asking for the next piece %Ld" nextpiece;
1473
                        send_extended_piece_request c nextpiece file;
1435
                        send_extended_piece_request c nextpiece file;
1474
                      end;
1436
                      end;
1475
                    end;
1437
                    end;
1476
                |_ ->
1438
                |_ ->
1477
                  lprintf_file_nl (as_file file) "unmatched extended subtype" ;
1439
                  if !verbose_msg_clients then
1440
                    lprintf_file_nl (as_file file) "unmatched extended subtype" ;
1478
            end;
1441
            end;
1479
1442
1480
            
1481
          | _ ->
1443
          | _ ->
1482
            lprintf_file_nl (as_file file) "Got extended other msg ";
1444
            if !verbose_msg_clients then
1445
              lprintf_file_nl (as_file file) "Got extended other msg ";
1483
      end;
1446
      end;
1484
1447
1485
    | DHT_Port port ->
1448
    | DHT_Port port ->
(-)src/networks/bittorrent/bTInteractive.ml.orig (-39 / +41 lines)
Lines 900-905 Link Here
900
  String.sub text a (b - a)
900
  String.sub text a (b - a)
901
901
902
let op_network_parse_url url user group =
902
let op_network_parse_url url user group =
903
        let exn_catch f x = try `Ok (f x) with exn -> `Exn exn in
904
        match exn_catch parse_magnet_url url with
905
          | `Ok magnet ->
906
            (
907
            if !verbose then begin
908
              lprintf_nl "Got magnet url %S" url;
909
              List.iter (fun(v) -> lprintf_nl "magnet %s" (string_of_uid v)) magnet#uids;
910
              List.iter (fun(v) -> lprintf_nl "magnet trackers %s" v) magnet#trackers;
911
            end;
912
            match List2.filter_map (function BTUrl btih -> Some btih | _ -> None) magnet#uids with
913
              | [] -> "No btih found in magnet url", false;
914
              | btih::_ ->
915
                if !verbose then
916
                  lprintf_nl "Got btih %S" (Sha1.to_string btih);
917
                let hashstr = (Sha1.to_string btih) in 
918
                let torrent = {
919
                  torrent_name = hashstr; (*magnet#name*)
920
                  torrent_filename = hashstr;
921
                  torrent_name_utf8 = hashstr;
922
                  torrent_comment = "";
923
                  torrent_pieces = Array.of_list [];  
924
                  torrent_piece_size = 1L;  
925
                  torrent_files = []; 
926
                  torrent_length = 1L;
927
                  torrent_created_by = ""; 
928
                  torrent_creation_date = 1000000L;
929
                  torrent_modified_by = ""; 
930
                  torrent_encoding = ""; 
931
                  torrent_private = false; 
932
                  torrent_announce =
933
                    (match magnet#trackers with
934
                     | h::q -> h
935
                     | [] -> "");
936
                  torrent_announce_list = magnet#trackers;
937
                }  in
938
                ignore(new_download ~metadata:true btih torrent "" user group);
939
                magnet#name, true; 
940
              )
941
          | `Exn _ ->
942
  (
903
  let location_regexp = "Location: \\(.*\\)" in
943
  let location_regexp = "Location: \\(.*\\)" in
904
  try
944
  try
905
    let real_url = get_regexp_string url (Str.regexp location_regexp) in
945
    let real_url = get_regexp_string url (Str.regexp location_regexp) in
Lines 966-971 Link Here
966
       let s = Printf.sprintf "Can not load load torrent file: %s"
1006
       let s = Printf.sprintf "Can not load load torrent file: %s"
967
         (Printexc2.to_string e) in
1007
         (Printexc2.to_string e) in
968
       s, false
1008
       s, false
1009
  )
969
1010
970
let op_client_info c =
1011
let op_client_info c =
971
  check_client_country_code c;
1012
  check_client_country_code c;
Lines 1280-1324 Link Here
1280
      _s ""
1321
      _s ""
1281
    ),  "<hash> :\t\t\tstart BT download using a hash DEBUG will go away";
1322
    ),  "<hash> :\t\t\tstart BT download using a hash DEBUG will go away";
1282
1323
1283
    "startbtmagnet", "Network/Bittorrent", Arg_one (fun magneturl o ->
1284
      begin
1285
        let exn_catch f x = try `Ok (f x) with exn -> `Exn exn in
1286
        match exn_catch parse_magnet_url magneturl with
1287
          | `Exn _ -> "Not a magnet url", false
1288
          | `Ok magnet ->
1289
            if !verbose then
1290
              lprintf_nl "Got magnet url %S" magneturl;
1291
            List.iter (fun(v) -> lprintf_nl "magnet %s" (string_of_uid v)) magnet#uids ;
1292
            match List2.filter_map (function BTUrl btih -> Some btih | _ -> None) magnet#uids with
1293
              | [] -> "No btih found in magnet url", false;
1294
              | btih::_ ->
1295
                lprintf_nl "Got btih %S" (Sha1.to_string btih);
1296
                let hashstr = (Sha1.to_string btih) in 
1297
                let torrent =          {
1298
                  torrent_name = hashstr; (*magnet#name*)
1299
                  torrent_filename = hashstr;
1300
                  torrent_name_utf8 = hashstr;
1301
                  torrent_comment = "";
1302
                  torrent_pieces = Array.of_list [];  
1303
                  torrent_piece_size = 1L;  
1304
                  torrent_files = []; 
1305
                  torrent_length = 1L;
1306
                  torrent_created_by = ""; 
1307
                  torrent_creation_date = 1000000L;
1308
                  torrent_modified_by = ""; 
1309
                  torrent_encoding = ""; 
1310
                  torrent_private = false; 
1311
                  torrent_announce = "";
1312
                  torrent_announce_list = [];
1313
                }  in
1314
                new_download ~metadata:true btih torrent "" o.conn_user.ui_user o.conn_user.ui_user.user_default_group;
1315
                magnet#name, true; 
1316
      end;
1317
      _s ""
1318
    ),  "<magneturl> :\t\t\tstart BT download using a bt magnet url DEBUG will go away";
1319
    
1320
1321
    
1322
    "stop_all_bt", "Network/Bittorrent", Arg_none (fun o ->
1324
    "stop_all_bt", "Network/Bittorrent", Arg_none (fun o ->
1323
      List.iter (fun file -> BTClients.file_stop file ) !current_files;
1325
      List.iter (fun file -> BTClients.file_stop file ) !current_files;
1324
      let buf = o.conn_buf in
1326
      let buf = o.conn_buf in

Return to bug 412169