Revert "test"

This reverts commit 8957a372d9.
This commit is contained in:
shoopea 2019-06-28 15:56:55 +08:00
parent d02e792e24
commit 19e33ee958
2 changed files with 7 additions and 5 deletions

View File

@ -9,9 +9,12 @@ import (
func clientKeepAlive(k, v interface{}) bool { func clientKeepAlive(k, v interface{}) bool {
clt := v.(*MQKeepAlive) clt := v.(*MQKeepAlive)
if clt.Date.Add(3 * KeepAliveHeartBeatSeconds * time.Second).Before(time.Now()) { if clt.Date.Add(3 * KeepAliveHeartBeatSeconds * time.Second).Before(time.Now()) {
msgs, err := clientsQueue[clt.UserID64].MQChannel.QueuePurge(clientsQueue[clt.UserID64].Queue.Name, false) msgs, err := clientsQueue[clt.UserID64].Channel.QueuePurge(clientsQueue[clt.UserID64].Queue.Name, false)
logOnError(err, "clientKeepAlive : Channel.QueuePurge()") logOnError(err, "clientKeepAlive : Channel.QueuePurge()")
clientsQueue[clt.UserID64].Close() err = clientsQueue[clt.UserID64].Channel.Close()
logOnError(err, "clientKeepAlive : Channel.Close()")
err = clientsQueue[clt.UserID64].Connection.Close()
logOnError(err, "clientKeepAlive : Connection.Close()")
c := TGCommand{ c := TGCommand{
Type: commandSendMsg, Type: commandSendMsg,
ToUserID64: clt.UserID64, ToUserID64: clt.UserID64,

5
mq.go
View File

@ -7,13 +7,12 @@ import (
) )
func (s MQSession) Open() error { func (s MQSession) Open() error {
var err error
if s.isConnected { if s.isConnected {
return errors.New("Session is already connected.") return errors.New("Session is already connected.")
} }
if SSL == false { if SLL == false {
s.MQConnection, err = amqp.Dial("amqp://" + s.User + ":" + s.Password + "@" + s.Host + "/" + s.Path) s.MQConnection, err = amqp.Dial("amqp://" + Session.User + ":" + Session.Password + "@" + Session.Host + "/" + Session.Path)
} else { } else {
return errors.New("SSL connection not implemented") return errors.New("SSL connection not implemented")
} }