mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net: check if socket descriptor is valid
This commit is contained in:
parent
1fde205f97
commit
d078e6bb08
@ -90,7 +90,7 @@ pub fn new_socket(family int, _type int, proto int) ?Socket {
|
||||
// This is needed so that there are no problems with reusing the
|
||||
// same port after the application exits.
|
||||
C.setsockopt(sockfd, C.SOL_SOCKET, C.SO_REUSEADDR, &one, sizeof(int))
|
||||
if sockfd == 0 {
|
||||
if sockfd == -1 {
|
||||
return error('net.socket: failed')
|
||||
}
|
||||
s := Socket{
|
||||
|
Loading…
Reference in New Issue
Block a user