parent
d02e792e24
commit
19e33ee958
@ -9,9 +9,12 @@ import (
|
||||
func clientKeepAlive(k, v interface{}) bool {
|
||||
clt := v.(*MQKeepAlive)
|
||||
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()")
|
||||
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{
|
||||
Type: commandSendMsg,
|
||||
ToUserID64: clt.UserID64,
|
||||
|
5
mq.go
5
mq.go
@ -7,13 +7,12 @@ import (
|
||||
)
|
||||
|
||||
func (s MQSession) Open() error {
|
||||
var err error
|
||||
if s.isConnected {
|
||||
return errors.New("Session is already connected.")
|
||||
}
|
||||
|
||||
if SSL == false {
|
||||
s.MQConnection, err = amqp.Dial("amqp://" + s.User + ":" + s.Password + "@" + s.Host + "/" + s.Path)
|
||||
if SLL == false {
|
||||
s.MQConnection, err = amqp.Dial("amqp://" + Session.User + ":" + Session.Password + "@" + Session.Host + "/" + Session.Path)
|
||||
} else {
|
||||
return errors.New("SSL connection not implemented")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user