@@ -198,7 +198,6 @@ func (a *Astilectron) listen() (err error) {
198
198
// Log
199
199
astilog .Debug ("Listening..." )
200
200
201
- var addr string
202
201
listenType := "tcp"
203
202
/*
204
203
* Switching between Unix-Socket and TCP-Socket
@@ -207,29 +206,25 @@ func (a *Astilectron) listen() (err error) {
207
206
*/
208
207
if len (a .options .Addr ) == 0 {
209
208
if runtime .GOOS != "windows" {
210
- addr = filepath .Join (a .paths .DataDirectory (), "astilectron.sock" )
209
+ a . options . Addr = filepath .Join (a .paths .DataDirectory (), "astilectron.sock" )
211
210
/*
212
211
* 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.
215
214
*/
216
- os .Remove (addr )
215
+ os .Remove (a . options . Addr )
217
216
listenType = "unix"
218
- a .options .Addr = "unix://" + a .options .Addr
219
217
} else {
220
- addr = "127.0.0.1:0"
221
- a .options .Addr = "tcp://" + addr
218
+ a .options .Addr = "127.0.0.1:0"
222
219
}
223
220
} else {
224
- addr = a .options .Addr
225
221
if runtime .GOOS != "windows" {
226
222
listenType = "unix"
227
223
}
228
- a .options .Addr = listenType + "://" + addr
229
224
}
230
225
231
226
// 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 {
233
228
return errors .Wrap (err , listenType + " net.Listen failed" )
234
229
}
235
230
0 commit comments