mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-13 19:38:11 -07:00
fix #283 (remove unnecessary log.Fatal)
The server should never crash during rehash, even if the config is invalid.
This commit is contained in:
+9
-10
@@ -7,7 +7,6 @@ package irc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
@@ -82,8 +81,8 @@ type Client struct {
|
||||
vhost string
|
||||
}
|
||||
|
||||
// NewClient returns a client with all the appropriate info setup.
|
||||
func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
|
||||
// NewClient sets up a new client and starts its goroutine.
|
||||
func NewClient(server *Server, conn net.Conn, isTLS bool) {
|
||||
now := time.Now()
|
||||
config := server.Config()
|
||||
fullLineLenLimit := config.Limits.LineLen.Tags + config.Limits.LineLen.Rest
|
||||
@@ -114,15 +113,17 @@ func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
|
||||
}
|
||||
if config.Server.CheckIdent && !utils.AddrIsUnix(conn.RemoteAddr()) {
|
||||
_, serverPortString, err := net.SplitHostPort(conn.LocalAddr().String())
|
||||
if err != nil {
|
||||
server.logger.Error("internal", "bad server address", err.Error())
|
||||
return
|
||||
}
|
||||
serverPort, _ := strconv.Atoi(serverPortString)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
clientHost, clientPortString, err := net.SplitHostPort(conn.RemoteAddr().String())
|
||||
clientPort, _ := strconv.Atoi(clientPortString)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
server.logger.Error("internal", "bad client address", err.Error())
|
||||
return
|
||||
}
|
||||
clientPort, _ := strconv.Atoi(clientPortString)
|
||||
|
||||
client.Notice(client.t("*** Looking up your username"))
|
||||
resp, err := ident.Query(clientHost, serverPort, clientPort, IdentTimeoutSeconds)
|
||||
@@ -141,8 +142,6 @@ func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
|
||||
}
|
||||
}
|
||||
go client.run()
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
func (client *Client) resetFakelag() {
|
||||
|
||||
Reference in New Issue
Block a user