GithubHelp home page GithubHelp logo

hrotti's People

Contributors

alsm avatar shoenig avatar wolfeidau avatar yosssi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hrotti's Issues

select case bloking in client.go

I tried this broker, found a little problem:
File client.go line:220, in method Receive(...),
select case <-c.stop: this case will never execute.
when i tried close the channel c.stop,
this case will never got in .
But in method Send(...) line:400, similar code , works ok!
I think may be the ReadPacket(...) method at line 260, blocking the select .
I found this code in packets.go:
func decodeLength(r io.Reader) int {
for {
....
}}
Please check if this a real problem, thank you !

about "hrotti.PersistStore.Delete"?

hello alsm,
in the "/hrotti/client",I have a doubt,when func Recive( ), recive a message, first use ReadPacket(c.conn), when ReadPacket(c.conn) , the func "NewControlPacketWithHeader(fh)" in the ReadPacket() will be get a NEW uuid value;
then when msg.(type)=*PubackPacket ,the func "hrotti.PersistStore.Delete(c.clientID, OUTBOUND, pa.UUID())" is pa.UUID()= the func "NewControlPacketWithHeader(fh)" get the NEW uuid value, is that right? the real record can be deleted ? I look forward to your answer!
In addition ,when msg.(type)=*PubcompPacket,why do you delete “hrotti.PersistStore.Delete(c, OUTBOUND, pc.UUID)”??

Important Vulnerabilities Disclosure

Hi,

I found 3 significant bugs in hrotti, all of which result in the server immediately crashing. One of these bugs was previously reported by another user, but it seems the report went ignored.

In the interest of responsible disclosure, I do not want to publicly disclose the details of these bugs before they are patched. However, it seems this repository is no longer actively maintained, and I do not see a way to contact the author privately. These bugs are included in a research paper I wrote, which is going to be published next May. So if the author is interested in patching hrotti, they can contact me at my email ([email protected]).

Thanks.

some code modify suggestions

router.go

func (n *Node) DeleteSub(client *Client, subscription []string, wg *sync.WaitGroup) {
n.Lock()
defer n.Unlock()
defer wg.Done()

switch x := len(subscription); {
//Deleting a subscription works in effectively the same way as adding a subscription
//but rather than adding to the HashSub/Sub maps we remove the entry for this client
case x > 0:
    if subscription[0] == "#" {
        delete(n.HashSub, client)
    } else if _, ok := n.Nodes[subscription[0]]; ok {
        wg.Add(1)
        go n.Nodes[subscription[0]].DeleteSub(client, subscription[1:], wg)
    }
case x == 0:
    delete(n.Sub, client)
}

}

subscriptions.go

func (c *Client) RemoveSubscriptions(topics []string) {
var wg sync.WaitGroup
for _, topic := range topics {
wg.Add(1)
topicArr := strings.Split(topic, "/")
go c.rootNode.DeleteSub(c, topicArr, &wg)
}
}

Default to port 1883?

Any reason (other than Go convention) that this is driven by env vars rather than command-line switches or a config file; and why not default to 1883?

Live reloading of config

We should be able to watch a configuration file for changes, work out the difference between current and new config and change on the go, closing deleted ports and opening new ones without interrupting the flow of messages on unchanged ports.

how to implements Persistence interface outside

want to implements Persistence outside the project source dir

type dirFlag byte
 
type Persistence interface {
	Add(string, dirFlag, ControlPacket) bool
}

but dirFlag is private type, can't use from outside?

broker can only handle 65530 connections

what's the problem?

linux kernel configuration

fs.file-max = 1048576
net.ipv4.tcp_mem = 786432 2097152 16777216
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216

net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30

net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 500 65535
net.ipv4.tcp_max_syn_backlog = 10240
net.ipv4.tcp_max_tw_buckets = 100000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.