aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/wnode
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/wnode')
-rw-r--r--cmd/wnode/main.go56
1 files changed, 32 insertions, 24 deletions
diff --git a/cmd/wnode/main.go b/cmd/wnode/main.go
index 00a854fe8..84bdfa4c3 100644
--- a/cmd/wnode/main.go
+++ b/cmd/wnode/main.go
@@ -110,6 +110,7 @@ func main() {
processArgs()
initialize()
run()
+ shutdown()
}
func processArgs() {
@@ -209,21 +210,6 @@ func initialize() {
MinimumAcceptedPOW: *argPoW,
}
- if *mailServerMode {
- if len(msPassword) == 0 {
- msPassword, err = console.Stdin.PromptPassword("Please enter the Mail Server password: ")
- if err != nil {
- utils.Fatalf("Failed to read Mail Server password: %s", err)
- }
- }
-
- shh = whisper.New(cfg)
- shh.RegisterServer(&mailServer)
- mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW)
- } else {
- shh = whisper.New(cfg)
- }
-
if *argPoW != whisper.DefaultMinimumPoW {
err := shh.SetMinimumPoW(*argPoW)
if err != nil {
@@ -265,6 +251,26 @@ func initialize() {
maxPeers = 800
}
+ _, err = crand.Read(entropy[:])
+ if err != nil {
+ utils.Fatalf("crypto/rand failed: %s", err)
+ }
+
+ if *mailServerMode {
+ if len(msPassword) == 0 {
+ msPassword, err = console.Stdin.PromptPassword("Please enter the Mail Server password: ")
+ if err != nil {
+ utils.Fatalf("Failed to read Mail Server password: %s", err)
+ }
+ }
+
+ shh = whisper.New(cfg)
+ shh.RegisterServer(&mailServer)
+ mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW)
+ } else {
+ shh = whisper.New(cfg)
+ }
+
server = &p2p.Server{
Config: p2p.Config{
PrivateKey: nodeid,
@@ -278,17 +284,13 @@ func initialize() {
TrustedNodes: peers,
},
}
-
- _, err = crand.Read(entropy[:])
- if err != nil {
- utils.Fatalf("crypto/rand failed: %s", err)
- }
}
-func startServer() {
+func startServer() error {
err := server.Start()
if err != nil {
- utils.Fatalf("Failed to start Whisper peer: %s.", err)
+ fmt.Printf("Failed to start Whisper peer: %s.", err)
+ return err
}
fmt.Printf("my public key: %s \n", common.ToHex(crypto.FromECDSAPub(&asymKey.PublicKey)))
@@ -307,6 +309,7 @@ func startServer() {
if !*forwarderMode {
fmt.Printf("Please type the message. To quit type: '%s'\n", quitCommand)
}
+ return nil
}
func isKeyValid(k *ecdsa.PublicKey) bool {
@@ -420,8 +423,10 @@ func waitForConnection(timeout bool) {
}
func run() {
- defer mailServer.Close()
- startServer()
+ err := startServer()
+ if err != nil {
+ return
+ }
defer server.Stop()
shh.Start(nil)
defer shh.Stop()
@@ -439,8 +444,11 @@ func run() {
} else {
sendLoop()
}
+}
+func shutdown() {
close(done)
+ mailServer.Close()
}
func sendLoop() {
+0800 committer asami <asami@FreeBSD.org> 2000-09-23 16:05:59 +0800 You don't want to depend on qt21 -- it's dead. Change them to USE_QT2.' href='/~lantw44/cgit/freebsd-ports/commit/irc/kvirc-devel/Makefile?id=ffc709f03e2dca0019338f7e4adf6917e19dbf95'>ffc709f03e2d
009b398a5bb3
9c0fabaf7b2b
3120d8acb3c5
9c0fabaf7b2b



8413f5e42c13
e282c995211f
ce64b7e1c78b
1cfdd11c9640
a57b005c8564
9c0fabaf7b2b



ce64b7e1c78b
9c0fabaf7b2b

3120d8acb3c5
a57b005c8564

9c0fabaf7b2b
3120d8acb3c5
1cfdd11c9640

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
                                             


                                                     
           

 
                     
                     
                   


                                                                               
 
                                  
 
                                                 
 
                     
                   



                       
                   
                 
                   
                   
                   



                                                   
                                                              

                                                      
                                        

                                    
 
                                      

                      
# New ports collection makefile for:    kvirc
# Date created:     Mon Feb 15 02:53:29 CET 1999
# Whom:         Anders Nordby <anders@fix.no>
#
# $FreeBSD$
#

PORTNAME=   kvirc
PORTVERSION=    2.1.1
CATEGORIES= irc
MASTER_SITES=   ftp://ftp.kvirc.net/kvirc/${PORTVERSION}/source/ \
        ftp://ftp.kvirc.bz.nu/pub/mirror/kvirc/${PORTVERSION}/source/ \
        ftp://kvirc.firenze.linux.it/pub/kvirc/${PORTVERSION}/source/

MAINTAINER= trevor@FreeBSD.org

BUILD_DEPENDS=  gettext:${PORTSDIR}/devel/gettext

ALL_TARGET= kvirc
INSTALLS_SHLIB= yes
MAN1=       kvirc.1
USE_LIBTOOL=    yes
USE_AUTOMAKE=   yes
USE_AUTOCONF=   yes
USE_BZIP2=  yes
USE_QT_VER= 2
USE_X_PREFIX=   yes
USE_GMAKE=  yes
QT_NONSTANDARD= yes
CONFIGURE_ARGS= --x-includes=$(X11BASE)/include \
        --x-libraries=$(X11BASE)/lib \
        --datadir=$(PREFIX)/share \
        --with-qt-moc=${X11BASE}/bin/moc2 \
        --with-qt-include-dir=${X11BASE}/include/qt2 \
        --with-qt-library-dir=${X11BASE}/lib \
        --without-kde-check \
        --with-freebsd-pthread \
        --with-qt-name=qt2 \
        --disable-static

CONFIGURE_ENV+= SS_X_EXTRA_LIBS=-lxpg4

.include <bsd.port.mk>