@@ -21,6 +21,7 @@ import (
21
21
"context"
22
22
"crypto/ecdsa"
23
23
"fmt"
24
+ "net"
24
25
25
26
"github.com/ethereum/go-ethereum/accounts/abi/bind"
26
27
"github.com/ethereum/go-ethereum/common"
@@ -166,13 +167,13 @@ Start is called when the stack is started
166
167
* TODO: start subservices like sword, swear, swarmdns
167
168
*/
168
169
// implements the node.Service interface
169
- func (self * Swarm ) Start (net * p2p.Server ) error {
170
+ func (self * Swarm ) Start (srv * p2p.Server ) error {
170
171
connectPeer := func (url string ) error {
171
172
node , err := discover .ParseNode (url )
172
173
if err != nil {
173
174
return fmt .Errorf ("invalid node URL: %v" , err )
174
175
}
175
- net .AddPeer (node )
176
+ srv .AddPeer (node )
176
177
return nil
177
178
}
178
179
// set chequebook
@@ -189,8 +190,8 @@ func (self *Swarm) Start(net *p2p.Server) error {
189
190
190
191
log .Warn (fmt .Sprintf ("Starting Swarm service" ))
191
192
self .hive .Start (
192
- discover .PubkeyID (& net .PrivateKey .PublicKey ),
193
- func () string { return net .ListenAddr },
193
+ discover .PubkeyID (& srv .PrivateKey .PublicKey ),
194
+ func () string { return srv .ListenAddr },
194
195
connectPeer ,
195
196
)
196
197
log .Info (fmt .Sprintf ("Swarm network started on bzz address: %v" , self .hive .Addr ()))
@@ -200,17 +201,16 @@ func (self *Swarm) Start(net *p2p.Server) error {
200
201
201
202
// start swarm http proxy server
202
203
if self .config .Port != "" {
203
- addr := ":" + self .config .Port
204
+ addr := net . JoinHostPort ( self . config . ListenAddr , self .config .Port )
204
205
go httpapi .StartHttpServer (self .api , & httpapi.ServerConfig {
205
206
Addr : addr ,
206
207
CorsString : self .corsString ,
207
208
})
208
- }
209
-
210
- log .Debug (fmt .Sprintf ("Swarm http proxy started on port: %v" , self .config .Port ))
209
+ log .Info (fmt .Sprintf ("Swarm http proxy started on %v" , addr ))
211
210
212
- if self .corsString != "" {
213
- log .Debug (fmt .Sprintf ("Swarm http proxy started with corsdomain: %v" , self .corsString ))
211
+ if self .corsString != "" {
212
+ log .Debug (fmt .Sprintf ("Swarm http proxy started with corsdomain: %v" , self .corsString ))
213
+ }
214
214
}
215
215
216
216
return nil
0 commit comments