|
|
@@ -12,6 +12,7 @@ import (
|
|
12
|
12
|
"github.com/9seconds/mtg/client"
|
|
13
|
13
|
"github.com/9seconds/mtg/config"
|
|
14
|
14
|
"github.com/9seconds/mtg/mtproto"
|
|
|
15
|
+ "github.com/9seconds/mtg/stats"
|
|
15
|
16
|
"github.com/9seconds/mtg/telegram"
|
|
16
|
17
|
"github.com/9seconds/mtg/wrappers"
|
|
17
|
18
|
)
|
|
|
@@ -45,6 +46,7 @@ func (p *Proxy) accept(conn net.Conn) {
|
|
45
|
46
|
conn.Close()
|
|
46
|
47
|
|
|
47
|
48
|
if err := recover(); err != nil {
|
|
|
49
|
+ stats.NewCrash()
|
|
48
|
50
|
log.Errorw("Crash of accept handler", "error", err)
|
|
49
|
51
|
}
|
|
50
|
52
|
}()
|
|
|
@@ -58,6 +60,9 @@ func (p *Proxy) accept(conn net.Conn) {
|
|
58
|
60
|
}
|
|
59
|
61
|
defer client.(io.Closer).Close()
|
|
60
|
62
|
|
|
|
63
|
+ stats.ClientConnected(opts.ConnectionType, client.RemoteAddr())
|
|
|
64
|
+ defer stats.ClientDisconnected(opts.ConnectionType, client.RemoteAddr())
|
|
|
65
|
+
|
|
61
|
66
|
server, err := p.getTelegramConn(opts, connID)
|
|
62
|
67
|
if err != nil {
|
|
63
|
68
|
log.Errorw("Cannot initialize server connection", "error", err)
|