diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-09-26 15:15:27 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-09-26 15:15:27 +0200 |
commit | 6fa65bded45957434db08e5d33fe82a04af73a59 (patch) | |
tree | 2f860cdea80d992da97625290757f7c6396131c1 /src | |
parent | 012e7b9d3316023e6ea891f9fe72f15d1db6668a (diff) |
Clean up error handling of listen port
Diffstat (limited to 'src')
-rw-r--r-- | src/uapi.go | 2 | ||||
-rw-r--r-- | src/uapi_darwin.go | 2 | ||||
-rw-r--r-- | src/uapi_linux.go | 2 | ||||
-rw-r--r-- | src/uapi_windows.go | 6 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/uapi.go b/src/uapi.go index 034033a..326216b 100644 --- a/src/uapi.go +++ b/src/uapi.go @@ -151,7 +151,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError { err = updateUDPConn(device) if err != nil { logError.Println("Failed to set listen_port:", err) - return &IPCError{Code: ipcErrorIO} + return &IPCError{Code: ipcErrorPortInUse} } // TODO: Clear source address of all peers diff --git a/src/uapi_darwin.go b/src/uapi_darwin.go index 13e5c4f..63d4d8d 100644 --- a/src/uapi_darwin.go +++ b/src/uapi_darwin.go @@ -11,9 +11,9 @@ import ( const ( ipcErrorIO = -int64(unix.EIO) - ipcErrorNotDefined = -int64(unix.ENODEV) ipcErrorProtocol = -int64(unix.EPROTO) ipcErrorInvalid = -int64(unix.EINVAL) + ipcErrorPortInUse = -int64(unix.EADDRINUSE) socketDirectory = "/var/run/wireguard" socketName = "%s.sock" ) diff --git a/src/uapi_linux.go b/src/uapi_linux.go index db4f040..cb9d858 100644 --- a/src/uapi_linux.go +++ b/src/uapi_linux.go @@ -11,9 +11,9 @@ import ( const ( ipcErrorIO = -int64(unix.EIO) - ipcErrorNotDefined = -int64(unix.ENODEV) ipcErrorProtocol = -int64(unix.EPROTO) ipcErrorInvalid = -int64(unix.EINVAL) + ipcErrorPortInUse = -int64(unix.EADDRINUSE) socketDirectory = "/var/run/wireguard" socketName = "%s.sock" ) diff --git a/src/uapi_windows.go b/src/uapi_windows.go index d56e965..a4599a5 100644 --- a/src/uapi_windows.go +++ b/src/uapi_windows.go @@ -12,9 +12,9 @@ import ( const ( ipcErrorIO = -int64(windows.ERROR_BROKEN_PIPE) - ipcErrorNotDefined = -int64(windows.ERROR_SERVICE_SPECIFIC_ERROR) - ipcErrorProtocol = -int64(windows.ERROR_SERVICE_SPECIFIC_ERROR) - ipcErrorInvalid = -int64(windows.ERROR_SERVICE_SPECIFIC_ERROR) + ipcErrorProtocol = -int64(windows.ERROR_INVALID_NAME) + ipcErrorInvalid = -int64(windows.ERROR_INVALID_PARAMETER) + ipcErrorPortInUse = -int64(windows.ERROR_ALREADY_EXISTS) ) const PipeNameFmt = "\\\\.\\pipe\\wireguard-ipc-%s" |