added correct error code for WSASocketW failure fallback
This commit is contained in:
parent
fdc0011561
commit
fa8b54901f
@ -100,7 +100,7 @@ pub fn new(addr: &SocketAddr, ty: c_int) -> io::Result<Socket> {
|
|||||||
c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) {
|
c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) {
|
||||||
c::INVALID_SOCKET => {
|
c::INVALID_SOCKET => {
|
||||||
match c::WSAGetLastError() {
|
match c::WSAGetLastError() {
|
||||||
c::WSAEPROTOTYPE => {
|
c::WSAEPROTOTYPE | c::WSAEINVAL => {
|
||||||
match c::WSASocketW(fam, ty, 0, ptr::null_mut(), 0,
|
match c::WSASocketW(fam, ty, 0, ptr::null_mut(), 0,
|
||||||
c::WSA_FLAG_OVERLAPPED) {
|
c::WSA_FLAG_OVERLAPPED) {
|
||||||
c::INVALID_SOCKET => Err(last_error()),
|
c::INVALID_SOCKET => Err(last_error()),
|
||||||
@ -199,7 +199,7 @@ pub fn duplicate(&self) -> io::Result<Socket> {
|
|||||||
c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) {
|
c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT) {
|
||||||
c::INVALID_SOCKET => {
|
c::INVALID_SOCKET => {
|
||||||
match c::WSAGetLastError() {
|
match c::WSAGetLastError() {
|
||||||
c::WSAEPROTOTYPE => {
|
c::WSAEPROTOTYPE | c::WSAEINVAL => {
|
||||||
match c::WSASocketW(info.iAddressFamily,
|
match c::WSASocketW(info.iAddressFamily,
|
||||||
info.iSocketType,
|
info.iSocketType,
|
||||||
info.iProtocol,
|
info.iProtocol,
|
||||||
|
Loading…
Reference in New Issue
Block a user