test
This commit is contained in:
parent
da7c548639
commit
8957a372d9
@ -9,12 +9,9 @@ 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].Channel.QueuePurge(clientsQueue[clt.UserID64].Queue.Name, false)
|
msgs, err := clientsQueue[clt.UserID64].MQChannel.QueuePurge(clientsQueue[clt.UserID64].Queue.Name, false)
|
||||||
logOnError(err, "clientKeepAlive : Channel.QueuePurge()")
|
logOnError(err, "clientKeepAlive : Channel.QueuePurge()")
|
||||||
err = clientsQueue[clt.UserID64].Channel.Close()
|
clientsQueue[clt.UserID64].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,12 +7,13 @@ 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 SLL == false {
|
if SSL == false {
|
||||||
s.MQConnection, err = amqp.Dial("amqp://" + Session.User + ":" + Session.Password + "@" + Session.Host + "/" + Session.Path)
|
s.MQConnection, err = amqp.Dial("amqp://" + s.User + ":" + s.Password + "@" + s.Host + "/" + s.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