alsm / hrotti Goto Github PK
View Code? Open in Web Editor NEWAn MQTT broker written in Go
License: Eclipse Public License 1.0
An MQTT broker written in Go
License: Eclipse Public License 1.0
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 !
hortti could support cluster?
the server shoud not crash in this case
panic: interface conversion: packets.ControlPacket is nil, not *packets.ConnectPacket
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)”??
Plan to add?
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.
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)
}
}
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?
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.
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?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.