parent
d02e792e24
commit
19e33ee958
@ -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
5
mq.go
@ -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")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user