mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-05 22:00:54 +00:00
this is why i wasn't using relative imports
This commit is contained in:
parent
1023b6ed11
commit
b3cbec4560
1 changed files with 13 additions and 14 deletions
|
@ -20,8 +20,6 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"bitbucket.org/stendec/frankerfacez/socketserver/server/logstasher"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SuccessCommand is a Reply Command to indicate success in reply to a C2S Command.
|
// SuccessCommand is a Reply Command to indicate success in reply to a C2S Command.
|
||||||
|
@ -108,7 +106,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if Configuration.UseESLogStashing {
|
if Configuration.UseESLogStashing {
|
||||||
logstasher.Setup(Configuration.ESServer, Configuration.ESIndexPrefix, Configuration.ESHostName)
|
// logstasher.Setup(Configuration.ESServer, Configuration.ESIndexPrefix, Configuration.ESHostName)
|
||||||
}
|
}
|
||||||
|
|
||||||
janitorsOnce.Do(startJanitors)
|
janitorsOnce.Do(startJanitors)
|
||||||
|
@ -310,9 +308,9 @@ func RunSocketConnection(conn *websocket.Conn) {
|
||||||
client.RemoteAddr = conn.RemoteAddr()
|
client.RemoteAddr = conn.RemoteAddr()
|
||||||
client.MsgChannelIsDone = stoppedChan
|
client.MsgChannelIsDone = stoppedChan
|
||||||
|
|
||||||
var report logstasher.ConnectionReport
|
// var report logstasher.ConnectionReport
|
||||||
report.ConnectTime = time.Now()
|
// report.ConnectTime = time.Now()
|
||||||
report.RemoteAddr = client.RemoteAddr
|
// report.RemoteAddr = client.RemoteAddr
|
||||||
|
|
||||||
conn.SetPongHandler(func(pongBody string) error {
|
conn.SetPongHandler(func(pongBody string) error {
|
||||||
client.Mutex.Lock()
|
client.Mutex.Lock()
|
||||||
|
@ -326,7 +324,8 @@ func RunSocketConnection(conn *websocket.Conn) {
|
||||||
closeReason := runSocketWriter(conn, &client, _errorChan, _clientChan, _serverMessageChan)
|
closeReason := runSocketWriter(conn, &client, _errorChan, _clientChan, _serverMessageChan)
|
||||||
|
|
||||||
// Exit
|
// Exit
|
||||||
closeConnection(conn, closeReason, &report)
|
closeConnection(conn, closeReason)
|
||||||
|
// closeConnection(conn, closeReason, &report)
|
||||||
|
|
||||||
// Launch message draining goroutine - we aren't out of the pub/sub records
|
// Launch message draining goroutine - we aren't out of the pub/sub records
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -353,9 +352,9 @@ func RunSocketConnection(conn *websocket.Conn) {
|
||||||
atomic.AddUint64(&Statistics.CurrentClientCount, NegativeOne)
|
atomic.AddUint64(&Statistics.CurrentClientCount, NegativeOne)
|
||||||
atomic.AddUint64(&Statistics.ClientDisconnectsTotal, 1)
|
atomic.AddUint64(&Statistics.ClientDisconnectsTotal, 1)
|
||||||
|
|
||||||
report.UsernameWasValidated = client.UsernameValidated
|
// report.UsernameWasValidated = client.UsernameValidated
|
||||||
report.TwitchUsername = client.TwitchUsername
|
// report.TwitchUsername = client.TwitchUsername
|
||||||
logstasher.Submit(&report)
|
// logstasher.Submit(&report)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +456,7 @@ func getDeadline() time.Time {
|
||||||
return time.Now().Add(1 * time.Minute)
|
return time.Now().Add(1 * time.Minute)
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeConnection(conn *websocket.Conn, closeMsg websocket.CloseError, report *logstasher.ConnectionReport) {
|
func closeConnection(conn *websocket.Conn, closeMsg websocket.CloseError) {
|
||||||
closeTxt := closeMsg.Text
|
closeTxt := closeMsg.Text
|
||||||
if strings.Contains(closeTxt, "read: connection reset by peer") {
|
if strings.Contains(closeTxt, "read: connection reset by peer") {
|
||||||
closeTxt = "read: connection reset by peer"
|
closeTxt = "read: connection reset by peer"
|
||||||
|
@ -467,9 +466,9 @@ func closeConnection(conn *websocket.Conn, closeMsg websocket.CloseError, report
|
||||||
closeTxt = "clean shutdown"
|
closeTxt = "clean shutdown"
|
||||||
}
|
}
|
||||||
|
|
||||||
report.DisconnectCode = closeMsg.Code
|
// report.DisconnectCode = closeMsg.Code
|
||||||
report.DisconnectReason = closeTxt
|
// report.DisconnectReason = closeTxt
|
||||||
report.DisconnectTime = time.Now()
|
// report.DisconnectTime = time.Now()
|
||||||
|
|
||||||
conn.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(closeMsg.Code, closeMsg.Text), getDeadline())
|
conn.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(closeMsg.Code, closeMsg.Text), getDeadline())
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue