Comments (13)
State tracking is potentially racey -- see the other open issue. In current master, state tracker handlers are run strictly before any other handlers for a particular event, and the (default) foreground handlers are run in parallel for that same event while blocking the runloop goroutine. Are you using the "background" handlers? Otherwise the state handlers ought to be completely done with their writes by the time your reads can execute. Or, i've messed something up, which is entirely plausible. I've not actually used the state tracking in anger ever, it was just ... practice.
from goirc.
It doesn't use any handler, it's a goroutine which shares the *client.Conn, calls Me() to get *state.Nick then Channels() to get the list of channels.
from goirc.
The idea of scattering locks all throughout this code is making me feel a bit ill, despite all the races inherent in the current design. Some handwaving:
The API presented by the current state tracker is a little ... public, I think. I don't know that external users of the package need the ability to create arbitrary nicks or channels except via the tracker. I was considering making all the tracker methods return struct copies of Nicks and Channels rather than pointers to the originals. More of the actual tracking could be moved into the tracker where fewer, coarser locks would be required, and the copies would represent the state of the tracker at the point the method was called. Mutating them would not affect internal tracker state.
Just a vague idea. Thoughts? I might have some time over Christmas to hack on code ;-)
from goirc.
+1 on returning copies. You'll still need locks but you can have one RWMutex per struct and the usual lock/defer unlock on methods.
from goirc.
@lucy @StalkR @stzanpet PTAL at the diff between master and state-copy. There's more to come -- I'm working on the changes to client/. Or, I would be, but a friend bought me KSP for Christmas :-D
from goirc.
Client changes pushed and tested. Things seem fine. This will probably break code that uses the state tracker, but that's probably also a good thing.
@sztanpet (spelled it wrong last time, sorry)
from goirc.
cheers for trying to take everybodies viewpoint into account, and happy new year!
(my code continues to work fine btw, also including me as a contributor is far-fetched but appreciated)
from goirc.
Cool @fluffle! As expected goircbot breaks, I'll start a branch with the changes like you did and test, then we can merge to our master when ready.
from goirc.
Done and it seems to works fine. Ready to merge in master when you are!
from goirc.
ping @fluffle :)
from goirc.
Sorry, bit busy with life. And, well Minecraft ;-)
On 12 Feb 2015 19:40, "StalkR" [email protected] wrote:
ping @fluffle https://github.com/fluffle :)
—
Reply to this email directly or view it on GitHub
#49 (comment).
from goirc.
You replied but didn't accept the merge?
from goirc.
Accept what merge? I've not merged my "state-copy" branch into my master yet because I've been busy, as I said. Fortunately for you I've got some time spare this evening ;-)
from goirc.
Related Issues (20)
- Dispatch runLoop deadlock when removing a handler from within a handler HOT 2
- Can read messages but can't seem to send? HOT 1
- Remove dependency on x/net/proxy HOT 2
- NewNick handler needs a max length check HOT 6
- Client gets very confused when nickname is longer than NICKLEN HOT 3
- xdcc client HOT 3
- Invalid/expired certificate HOT 8
- Support IRCv3 capability negotiation during registration. HOT 8
- Support STARTTLS (and CAP tls requesting).
- Allow rate limiting code to be changed. HOT 2
- question only. HOT 1
- TestPing is unstable... HOT 7
- TLS issues not detected at connection time HOT 1
- Allow user to close connection if server doesn't close after to QUIT. HOT 4
- Can I handle event RECONNECT? HOT 2
- ERROR message from the server is not handled HOT 1
- Stupid question (new to irc in general) HOT 2
- Conn:String method deadlock HOT 1
- disconnect event delay too much HOT 2
- call of reflect.Value.Type on zero Value HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goirc.