]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go
Forbid any later GNU GPL versions autousage
[nncp.git] / src / cypherpunks.ru / nncp / cmd / nncp-daemon / main.go
index b23083878779b456b2ad9d5eb6dfbc4e38b8317f..67e2c533f410b3b8410bc2bab74b80f160f299e3 100644 (file)
@@ -1,11 +1,10 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2018 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -61,8 +60,11 @@ func (ic *InetdConn) SetWriteDeadline(t time.Time) error {
 }
 
 func performSP(ctx *nncp.Ctx, conn nncp.ConnDeadlined, nice uint8) {
-       state, err := ctx.StartR(conn, nice, "")
-       if err == nil {
+       state := nncp.SPState{
+               Ctx:  ctx,
+               Nice: nice,
+       }
+       if err := state.StartR(conn); err == nil {
                ctx.LogI("call-start", nncp.SDS{"node": state.Node.Id}, "connected")
                state.Wait()
                ctx.LogI("call-finish", nncp.SDS{
@@ -75,7 +77,7 @@ func performSP(ctx *nncp.Ctx, conn nncp.ConnDeadlined, nice uint8) {
                }, "")
        } else {
                nodeId := "unknown"
-               if state != nil && state.Node != nil {
+               if state.Node != nil {
                        nodeId = state.Node.Id.String()
                }
                ctx.LogE("call-start", nncp.SDS{"node": nodeId, "err": err}, "")