P2p: do not send peer swap requests in private mode
This commit is contained in:
parent
01648e7611
commit
c1ccea3501
@ -1023,8 +1023,7 @@ let accept pool fd point =
|
||||
|
||||
let send_swap_request pool =
|
||||
match Connection.random pool with
|
||||
| None -> ()
|
||||
| Some recipient ->
|
||||
| Some recipient when not pool.config.private_mode -> begin
|
||||
let recipient_peer_id = (Connection.info recipient).peer_id in
|
||||
match Connection.random_lowid ~different_than:recipient pool with
|
||||
| None -> ()
|
||||
@ -1034,6 +1033,8 @@ let send_swap_request pool =
|
||||
Some (Time.now (), proposed_peer_id) ;
|
||||
ignore (P2p_socket.write_now recipient.conn
|
||||
(Swap_request (proposed_point, proposed_peer_id)))
|
||||
end
|
||||
| Some _ | None -> ()
|
||||
|
||||
(***************************************************************************)
|
||||
|
||||
|
@ -168,6 +168,9 @@ val config : _ pool -> config
|
||||
creation. *)
|
||||
|
||||
val send_swap_request: ('msg, 'peer_meta,'conn_meta) pool -> unit
|
||||
(** [send_swap_request pool] given two connected peers pi and pj (pi
|
||||
<> pj), suggest swap with pi for the peer pj. This behaviour is
|
||||
disabled in private mode *)
|
||||
|
||||
(** {2 Pool events} *)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user