mirror of https://github.com/dswd/vpncloud.git
Fixed duplicate port bindings
This commit is contained in:
parent
714d8c3220
commit
f6a72e4174
|
@ -12,6 +12,7 @@ This project follows [semantic versioning](http://semver.org).
|
||||||
- [fixed] Added parameter keepalive to manpage
|
- [fixed] Added parameter keepalive to manpage
|
||||||
- [fixed] Fixed problems on stats file when dropping permissions
|
- [fixed] Fixed problems on stats file when dropping permissions
|
||||||
- [fixed] Deleting files before overwriting them
|
- [fixed] Deleting files before overwriting them
|
||||||
|
- [fixed] Fixed duplicate port bindings
|
||||||
|
|
||||||
### v1.1.0 (2019-12-04)
|
### v1.1.0 (2019-12-04)
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,13 @@ pub trait Socket: AsRawFd + Sized {
|
||||||
|
|
||||||
impl Socket for UdpSocket {
|
impl Socket for UdpSocket {
|
||||||
fn listen_v4(host: &str, port: u16) -> Result<Self, io::Error> {
|
fn listen_v4(host: &str, port: u16) -> Result<Self, io::Error> {
|
||||||
UdpBuilder::new_v4()
|
UdpBuilder::new_v4().expect("Failed to obtain ipv4 socket builder").bind((host, port))
|
||||||
.expect("Failed to obtain ipv4 socket builder")
|
|
||||||
.reuse_address(true)
|
|
||||||
.expect("Failed to set so_reuseaddr")
|
|
||||||
.bind((host, port))
|
|
||||||
}
|
}
|
||||||
fn listen_v6(host: &str, port: u16) -> Result<Self, io::Error> {
|
fn listen_v6(host: &str, port: u16) -> Result<Self, io::Error> {
|
||||||
UdpBuilder::new_v6()
|
UdpBuilder::new_v6()
|
||||||
.expect("Failed to obtain ipv4 socket builder")
|
.expect("Failed to obtain ipv4 socket builder")
|
||||||
.only_v6(true)
|
.only_v6(true)
|
||||||
.expect("Failed to set only_v6")
|
.expect("Failed to set only_v6")
|
||||||
.reuse_address(true)
|
|
||||||
.expect("Failed to set so_reuseaddr")
|
|
||||||
.bind((host, port))
|
.bind((host, port))
|
||||||
}
|
}
|
||||||
fn receive(&mut self, buffer: &mut [u8]) -> Result<(usize, SocketAddr), io::Error> {
|
fn receive(&mut self, buffer: &mut [u8]) -> Result<(usize, SocketAddr), io::Error> {
|
||||||
|
|
Loading…
Reference in New Issue