Skip to content

Commit

Permalink
Cleanup commented code
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Jul 20, 2018
1 parent 3a0f262 commit eed8993
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 61 deletions.
13 changes: 7 additions & 6 deletions clients/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,19 +400,20 @@ func (m *Manager) newSession(cn connection.Initial, params *connection.ConnectPa

if cn.Acknowledge(ack, connection.KeepAlive(keepAlive)) {
ses.start()

// TODO(troian): add remote address
status := &systree.ClientConnectStatus{
Username: string(params.Username),
Timestamp: time.Now().Format(time.RFC3339),
ReceiveMaximum: uint32(params.SendQuota),
MaximumPacketSize: params.MaxTxPacketSize,
GeneratedID: params.IDGen,
SessionPresent: ack.SessionPresent(),
//Address: cn.RemoteAddr().String(),
KeepAlive: uint16(keepAlive),
ConnAckCode: ack.ReturnCode(),
Protocol: params.Version,
CleanSession: params.CleanStart,
Durable: params.Durable,
KeepAlive: uint16(keepAlive),
ConnAckCode: ack.ReturnCode(),
Protocol: params.Version,
CleanSession: params.CleanStart,
Durable: params.Durable,
}

m.Systree.Clients().Connected(params.ID, status)
Expand Down
8 changes: 1 addition & 7 deletions connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ type DisconnectParams struct {
Packets persistence.PersistedPackets
}

//type onDisconnect func(*DisconnectParams)

// Callbacks provided by sessions manager to signal session state
type Callbacks struct {
// OnStop called when session stopped net connection and should be either suspended or deleted
Expand Down Expand Up @@ -779,9 +777,6 @@ func (s *impl) onPublish(pkt *mqttp.Publish) (mqttp.IFace, error) {
// - ignore the message but send acks
// - return error leading to disconnect
// TODO: publish permissions
//if status := s.ACL(s.ID, pkt.Topic(), auth.AccessTypeWrite); status == auth.StatusDeny {
// reason = mqttp.CodeAdministrativeAction
//}

switch pkt.QoS() {
case mqttp.QoS2:
Expand Down Expand Up @@ -822,14 +817,13 @@ func (s *impl) onPublish(pkt *mqttp.Publish) (mqttp.IFace, error) {
case mqttp.QoS0: // QoS 0
// [MQTT-4.3.1]
// [MQTT-4.3.2-4]
// if reason < mqttp.CodeUnspecifiedError {
// TODO(troian): ignore if publish permissions not validated
if err = s.publishToTopic(pkt); err != nil {
s.log.Error("Couldn't publish message",
zap.String("ClientID", s.id),
zap.Uint8("QoS", uint8(pkt.QoS())),
zap.Error(err))
}
// }
}

return resp, err
Expand Down
3 changes: 1 addition & 2 deletions dockerBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ fi
docker build $buildArgs .

echo "removing intermediate container"
docker rmi -f $(docker images -q --filter label=stage=intermediate)
#docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
docker rmi -f $(docker images -q --filter label=stage=intermediate)
14 changes: 0 additions & 14 deletions server/volantmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,6 @@ func NewServer(config Config) (Server, error) {
return nil, err
}

//generateNodeID := func() string {
// return uuid.New() + "@volantmq.io"
//}

//if systemState.NodeName == "" || s.RewriteNodeName {
// if s.NodeName == "" {
// s.NodeName = generateNodeID()
// }
//
// systemState.NodeName = s.NodeName
//} else {
// s.NodeName = systemState.NodeName
//}

if err = systemPersistence.SetInfo(systemState); err != nil {
return nil, err
}
Expand Down
18 changes: 1 addition & 17 deletions topics/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import (
"github.com/VolantMQ/volantmq/types"
)

//var (
// // ErrUnknownProvider unknown provider
// ErrUnknownProvider = errors.New("Unknown provider")
//)

const (
// MWC is the multi-level wildcard
MWC = "#"
Expand All @@ -22,13 +17,7 @@ const (
SWC = "+"

// SEP is the topic level separator
//SEP = "/"

// SYS is the starting character of the system level topics
//SYS = "$"

// Both wildcards
//BWC = "#+"
SEP = "/"
)

var (
Expand Down Expand Up @@ -58,11 +47,6 @@ var (

// ErrNotFound object not found
ErrNotFound = errors.New("topics: not found")

// ErrNotOpen storage is not open
//ErrNotOpen = errors.New("not open")

//ErrOverflow = errors.New("overflow")
)

// Subscriber used inside each session as an object to provide to topic manager upon subscribe
Expand Down
15 changes: 0 additions & 15 deletions transport/connTCP.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
type connTCP struct {
conn net.Conn
stat systree.BytesMetric
//pollDesc
//timer *time.Timer
}

var _ Conn = (*connTCP)(nil)
Expand All @@ -34,8 +32,6 @@ func (c *connTCP) Write(b []byte) (int, error) {
}

func (c *connTCP) Close() error {
//c.ePoll.Stop(c.desc)
//c.desc.Close()
return c.conn.Close()
}

Expand All @@ -52,17 +48,6 @@ func (c *connTCP) SetDeadline(t time.Time) error {
}

func (c *connTCP) SetReadDeadline(t time.Time) error {
//if t.IsZero() && c.timer != nil {
// if !c.timer.Stop() {
// return errors.New("keepAlive expired")
// }
//} else {
// if c.timer == nil {
// c.timer = time.AfterFunc(t.Sub(time.Now()), c.keepAlive)
// } else {
// c.timer.Reset(t.Sub(time.Now()))
// }
//}
return c.conn.SetReadDeadline(t)
}

Expand Down

0 comments on commit eed8993

Please sign in to comment.