From 16af79d24327b29f407f1d1890383ea454937f92 Mon Sep 17 00:00:00 2001 From: Jeff Jenkins Date: Thu, 17 Dec 2015 11:43:23 -0500 Subject: [PATCH] Remove confirm mode code --- server/channel.go | 16 ---------------- server/confirmMethods.go | 22 ---------------------- 2 files changed, 38 deletions(-) delete mode 100644 server/confirmMethods.go diff --git a/server/channel.go b/server/channel.go index 70e2f13..f56e877 100644 --- a/server/channel.go +++ b/server/channel.go @@ -26,7 +26,6 @@ type Channel struct { outgoing chan *amqp.WireFrame conn *AMQPConnection state uint8 - confirmMode bool currentMessage *amqp.Message consumers map[string]*consumer.Consumer consumerLock sync.Mutex @@ -491,20 +490,11 @@ func (channel *Channel) setStateOpen() { channel.state = CH_STATE_OPEN } -func (channel *Channel) activateConfirmMode() { - channel.confirmMode = true -} - func (channel *Channel) startPublish(method *amqp.BasicPublish) error { channel.currentMessage = amqp.NewMessage(method, channel.conn.id) return nil } -func (channel *Channel) nextConfirmId() uint64 { - channel.msgIndex++ - return channel.msgIndex -} - func (channel *Channel) nextDeliveryTag() uint64 { channel.deliveryLock.Lock() channel.deliveryTag++ @@ -717,10 +707,6 @@ func (channel *Channel) handleContentBody(frame *amqp.WireFrame) *amqp.AMQPError } channel.currentMessage = nil - if channel.confirmMode { - channel.msgIndex += 1 - channel.SendMethod(&amqp.BasicAck{channel.msgIndex, false}) - } return nil } @@ -763,8 +749,6 @@ func (channel *Channel) routeMethod(frame *amqp.WireFrame) *amqp.AMQPError { return channel.basicRoute(methodFrame) case classId == 90: return channel.txRoute(methodFrame) - case classId == 85: - return channel.confirmRoute(methodFrame) default: return amqp.NewHardError(540, "Not implemented", classId, methodId) } diff --git a/server/confirmMethods.go b/server/confirmMethods.go deleted file mode 100644 index 7525d98..0000000 --- a/server/confirmMethods.go +++ /dev/null @@ -1,22 +0,0 @@ -package server - -import ( - "github.com/jeffjenkins/dispatchd/amqp" -) - -func (channel *Channel) confirmRoute(methodFrame amqp.MethodFrame) *amqp.AMQPError { - switch method := methodFrame.(type) { - case *amqp.ConfirmSelect: - channel.activateConfirmMode() - return channel.confirmSelect(method) - } - var classId, methodId = methodFrame.MethodIdentifier() - return amqp.NewHardError(540, "Unable to route method frame", classId, methodId) -} - -func (channel *Channel) confirmSelect(method *amqp.ConfirmSelect) *amqp.AMQPError { - if !method.Nowait { - channel.SendMethod(&amqp.ConfirmSelectOk{}) - } - return nil -}