mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Shorten log about started server and accepted client a bit.
This commit is contained in:
parent
4a3df9a86b
commit
0b11ac01db
5
main.go
5
main.go
@ -257,6 +257,7 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer listener.Close()
|
defer listener.Close()
|
||||||
|
log.Printf("Server started at %s", listener.Addr())
|
||||||
|
|
||||||
connChan := make(chan net.Conn)
|
connChan := make(chan net.Conn)
|
||||||
defer close(connChan)
|
defer close(connChan)
|
||||||
@ -264,13 +265,12 @@ func main() {
|
|||||||
signal.Notify(sigChan, os.Interrupt, os.Kill)
|
signal.Notify(sigChan, os.Interrupt, os.Kill)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Println("Server started")
|
|
||||||
for {
|
for {
|
||||||
conn, err := listener.Accept()
|
conn, err := listener.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
log.Printf("Client accepted: %s", conn)
|
log.Printf("Client accepted from: %s", conn.RemoteAddr())
|
||||||
connChan <- conn
|
connChan <- conn
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -278,7 +278,6 @@ func main() {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case conn := <-connChan:
|
case conn := <-connChan:
|
||||||
log.Printf("New connection %s", conn)
|
|
||||||
go newConnection(conn, db).run()
|
go newConnection(conn, db).run()
|
||||||
case <-sigChan:
|
case <-sigChan:
|
||||||
log.Println("Shutting down")
|
log.Println("Shutting down")
|
||||||
|
Loading…
Reference in New Issue
Block a user