1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! This module contains the functions
//! for cancelling binary sessions and
//! shutdown the related UdpSocket.
//!
//! *This module is available only if MultiCrusty is built with
//! the `"transport"` feature or the `"transport_udp"` feature.*
use mem;
use UdpSocket;
/// Cancels a session. Always succeeds. If the partner calls
/// `send`, `recv` or `close` after cancellation,
/// those calls fail. Used for UDP transport.
///
/// Drops the session *s* and shutdowns the `UdpSocket` *socket*
///
/// # Example
///
/// ```
/// use mpstthree::binary::struct_trait::end::End;
/// use mpstthree::binary::struct_trait::session::Session;
/// use mpstthree::meshedchannels::MeshedChannels;
/// use mpstthree::name::a::NameA;
/// use mpstthree::role::end::RoleEnd;
/// use mpstthree::transport::udp::cancel::cancel_udp;
/// use std::net::UdpSocket;
///
/// let socket = UdpSocket::bind("0.0.0.0:3333").unwrap();
/// let (s, _s_dual) = MeshedChannels::<End, End, RoleEnd, NameA>::new();
/// cancel_udp(s, socket);
/// ```
///
/// *This function is available only if MultiCrusty is built with
/// the `"transport"` feature or the `"transport_udp"` feature.*