mirror of
https://github.com/ergochat/ergo.git
synced 2025-01-03 08:32:43 +01:00
make server logging consistent with other logs
This commit is contained in:
parent
58517ad4e8
commit
4f106e7d3e
@ -118,9 +118,6 @@ func (client *Client) connectionClosed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) Destroy() {
|
func (client *Client) Destroy() {
|
||||||
if DEBUG_CLIENT {
|
|
||||||
log.Printf("%s: destroying", client)
|
|
||||||
}
|
|
||||||
// clean up self
|
// clean up self
|
||||||
|
|
||||||
client.socket.Close()
|
client.socket.Close()
|
||||||
|
@ -121,19 +121,23 @@ func newListener(config ListenerConfig) (net.Listener, error) {
|
|||||||
func (s *Server) listen(config ListenerConfig) {
|
func (s *Server) listen(config ListenerConfig) {
|
||||||
listener, err := newListener(config)
|
listener, err := newListener(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Server.Listen: ", err)
|
log.Fatal(s, "listen error: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Print("Server.Listen: listening on ", config.Address)
|
if DEBUG_SERVER {
|
||||||
|
log.Printf("%s listening on %s", s, config.Address)
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
conn, err := listener.Accept()
|
conn, err := listener.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Server.Accept: ", err)
|
if DEBUG_SERVER {
|
||||||
|
log.Printf("%s accept error: %s", s, err)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if DEBUG_SERVER {
|
if DEBUG_SERVER {
|
||||||
log.Print("Server.Accept: ", conn.RemoteAddr())
|
log.Printf("%s accept: %s", s, conn.RemoteAddr())
|
||||||
}
|
}
|
||||||
|
|
||||||
s.conns <- conn
|
s.conns <- conn
|
||||||
|
@ -76,9 +76,6 @@ func (socket *Socket) readLines() {
|
|||||||
|
|
||||||
close(socket.receive)
|
close(socket.receive)
|
||||||
socket.Close()
|
socket.Close()
|
||||||
if DEBUG_NET {
|
|
||||||
log.Printf("%s closed", socket)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (socket *Socket) writeLines() {
|
func (socket *Socket) writeLines() {
|
||||||
@ -105,13 +102,14 @@ func (socket *Socket) writeLines() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if DEBUG_NET {
|
|
||||||
log.Printf("%s closing", socket)
|
|
||||||
}
|
|
||||||
if done {
|
if done {
|
||||||
socket.conn.Close()
|
socket.conn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if DEBUG_NET {
|
||||||
|
log.Printf("%s closed", socket)
|
||||||
|
}
|
||||||
|
|
||||||
// read incoming messages and discard to avoid hangs
|
// read incoming messages and discard to avoid hangs
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
Loading…
Reference in New Issue
Block a user