Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0302461

Browse files
committedNov 9, 2019
chnages for connection address, address being passed without <unix/tcp>://<path/port>
1 parent ac66b4f commit 0302461

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed
 

‎astilectron.go

+6-11
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ func (a *Astilectron) listen() (err error) {
198198
// Log
199199
astilog.Debug("Listening...")
200200

201-
var addr string
202201
listenType := "tcp"
203202
/*
204203
* Switching between Unix-Socket and TCP-Socket
@@ -207,29 +206,25 @@ func (a *Astilectron) listen() (err error) {
207206
*/
208207
if len(a.options.Addr) == 0 {
209208
if runtime.GOOS != "windows" {
210-
addr = filepath.Join(a.paths.DataDirectory(), "astilectron.sock")
209+
a.options.Addr = filepath.Join(a.paths.DataDirectory(), "astilectron.sock")
211210
/*
212211
* Not checking error for this, as this step
213-
* is to avoid any error for net.listen while creation
214-
* of unix socket.
212+
* is to avoid any error for net.listen while
213+
* creation of unix socket.
215214
*/
216-
os.Remove(addr)
215+
os.Remove(a.options.Addr)
217216
listenType = "unix"
218-
a.options.Addr = "unix://" + a.options.Addr
219217
} else {
220-
addr = "127.0.0.1:0"
221-
a.options.Addr = "tcp://" + addr
218+
a.options.Addr = "127.0.0.1:0"
222219
}
223220
} else {
224-
addr = a.options.Addr
225221
if runtime.GOOS != "windows" {
226222
listenType = "unix"
227223
}
228-
a.options.Addr = listenType + "://" + addr
229224
}
230225

231226
// Listen
232-
if a.listener, err = net.Listen(listenType, addr); err != nil {
227+
if a.listener, err = net.Listen(listenType, a.options.Addr); err != nil {
233228
return errors.Wrap(err, listenType+" net.Listen failed")
234229
}
235230

0 commit comments

Comments
 (0)
This repository has been archived.