summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-07-03Rename encoder_decoder.go to xml.goxengineering
This is way shorter and serves the same purpose: It reflects the responsibility of encoding and decoding XML. The encoderDecoder struct should be removed soon.
2023-07-03Rename stream_pair.go to streams.goxengineering
The fact that it is actually about a pair of XML streams is obvious and not that relevant. A shorter name has a higher priority.
2023-07-03Use xml.Encoder.EncodeElement() for presencexengineering
This required the trick of defining an empty struct as `presence` type but works pretty well. For sending data EncodeElement instead of token handling should always work. Since it is simpler it should be used.
2023-07-03Switch to EncodeElement() for resource bindingxengineering
2023-07-03Switch to EncodeElement() for SASL authxengineering
2023-07-03Update to Gio v0.1.0xengineering
Gio started to use releases. LimoX should take advantage of this.
2023-07-03Merge branch 'fix-btn-callback-race'xengineering
This fixes a race condition which was discovered during testing with a bad network connection. Good network connections seem to hide this error.
2023-07-03Remove intended breakagexengineering
This removes the injected broken code which made the race condition reproducible.
2023-07-03Fix race condition on struct Limoxxengineering
To make message passing to the XMPP session channel non-blocking short living Goroutines are used. Before this commit they were executing closures which capture l as xengineering.eu/limox.Limox pointer and used it to get the channel where the message should be passed to. While channels are safe with respect to race conditions, structs are not. Thus the member access of the Limox struct was a race condition in certain side cases like bad network connection where those Goroutines lived for a longer time. The solution is to make a copy of the l.sessionIn channel and use this copy in the closures. This is valid since channels do not need pointers to them and furthermore are thread safe.
2023-07-03BROKEN: Make bug reliablexengineering
This should make the race appear reliable if a second connection attempt is made. It is important to have a reliable error to fix it reliably.
2023-07-01Merge branch 'byte-based-logging'xengineering
Logging used to re-encode tokens for receive logging and double-encode tokens for send logging. This had the flexibility to pretty-print the XML. Furthermore it was trivial to prepend a prefix like `S: ` and `C: ` for server and client. This merge moves away from logging based on re-encoding XML tokens. Instead the received or sent bytes are multiplexed to a logger which uses the log module of the standard library to log the XML code. These advantages come with this merge: - [TX] / [RX] instead of C: / S: as prefixes (direction instead of node) - encoding issues can be debugged via the log - everything is now logged via the log module and has timestamps The only disadvantage is that the logged XML is not pretty-printed anymore. This is choosen for the RX stream to not accidentally hide encoding issues and show what is really on the wire. That argument is true for TX aswell and consistency is appreciated anyway.
2023-07-01Drop xml.{ProcInst,Directive,Comment}xengineering
LimoX does not care about these XML tokens at least for now. The issued error messages on other levels. Dropping those tokens on the encoderDecoder level asserts that the rest of the xmpp code has only `clean` XML content to process.
2023-07-01Improve prefix and disable indentxengineering
The prefix has now more visual contrast to the XML content due to its own bracket style. Furthermore the indent for the TX stream was disabled. Indent is a nice thing but it just makes sense if both streams are indented identically. Since the RX stream received from the current development server has no indent and also no newlines it is better to turn it of completely. This might change in the future with structured logging (with the new slog package) or command line flags to toggle this behaviour. Re-encoding of the RX stream could also be an option but should stay one because it alters the RX stream and might hide errors during debugging.
2023-07-01Add log module based XML logging with prefixxengineering
The prefix is re-implemented with this commit to distinguish between RX and TX XML. Furthermore the logging is now based on the log module to have the same (e.g. timestamp) prefix as other log messages.
2023-07-01Implement byte-based logging for RXxengineering
This commit uses an io.TeeReader to achieve the same goal for RX like in the previous commit for TX.
2023-07-01Implement byte-based logging for TXxengineering
Using an io.MultiWriter it is trivially possible to write encoded tokens to the TCP channel aswell as to stdout. The disadvantage is that it is not possible to inject prefix data like the so far used `C: ` only for stdout and not for the TCP channel. Such a prefix is not wanted in the TCP channel and thus not wanted for both. The solution to get a nice log is to implement a transparent logging middleware which gets the raw TX stream and inserts a prefix at each line before sending to stdout.
2023-07-01Remove refactoring-related items from ROADMAPxengineering
The ROADMAP should cover user-visible changes and not internal ones.
2023-06-30Remove roster retrieval from ROADMAP for WIPxengineering
It is not required for a minimal single user chat demo if the user enters the recipient address manually. Leaving that out removes a feature from the list of tasks for a minimal viable product and thus makes the path to the next refactoring / quality gate shorter.
2023-06-30Merge branch 'initial-presence'xengineering
This broadcasts that the LimoX client is ready for communication.
2023-06-30Update ROADMAPxengineering
2023-06-30Send initial presence after resource resultxengineering
This completes the connection process.
2023-06-30Merge branch 'resource-binding'xengineering
This adds some really basic resource binding implementation which will work for now but has to be improved for a first release.
2023-06-30Apply go fmtxengineering
2023-06-30Update ROADMAPxengineering
2023-06-30Add log-only handler for received IQ stanzasxengineering
This handler is just a placeholder for a more extensive IQ handling but already writes to the log so that it is obvious what is happening.
2023-06-30Implement resource binding requestxengineering
This is the first step of resource binding which is a mandatory part of establishing an XMPP connection.
2023-06-30Implement detection of resource binding offerxengineering
This allows to trigger resource binding if the stream supports it.
2023-06-30Merge branch 'stream-features'xengineering
The added code provides a structured way to handle features offered by the server.
2023-06-30Apply go fmtxengineering
2023-06-30Implement basic handler for failed SASL authxengineering
Writing to the log is still better than doing nothing ...
2023-06-30Make streamFeaturesHandler() more genericxengineering
The new structure allows to check for different stream features and act according to them or - if nothing matches - do nothing apart from an error message to the log.
2023-06-30Rework and apply stream nesting on SASL successxengineering
If SASL authentication is successful a new stream has to be opened by the client. This is implemented with this commit.
2023-06-30Add SASL success handlerxengineering
2023-06-30Send SASL request based on new routingxengineering
2023-06-30Add session pointer to routing infrastructurexengineering
It is nearly useless to route a XML element to an appropriate handler function if the latter has no idea how to send responses to the server or the GUI. Passing a pointer to the session solves this issue.
2023-06-30Fix debug messagexengineering
2023-06-30Move SASL mechanism detection to xmpp/sasl.goxengineering
2023-06-30Add detection for SASL mechanismxengineering
This is needed to respond with a SASL auth attempt.
2023-06-30Add dummy handler for stream features elementsxengineering
This is the first step to handle stream features correctly with the new routing infrastructure.
2023-06-30Merge branch 'routing'xengineering
This adds an XML element router and a corresponding unit test. The element router will be used to register XML element handler with a single line.
2023-06-30Add unit test for routing functionxengineering
2023-06-30Add xmpp/router.goxengineering
This implements a routing function for XML elements received by an XML stream.
2023-06-29Merge branch 'element-buffer'xengineering
This adds xengineering.eu/limox/xmpp/elementBuffer which is a buffer for a collection of XML tokens which are further processed after a full XML element is collected.
2023-06-29Add FIXME to element buffer specificationxengineering
The behaviour is ok for now but should be improved in the future to make it more robust.
2023-06-29Document element buffer test point structxengineering
This makes it easier to add further test data in case there are further corner cases which should be tested in the future.
2023-06-29Minor improvements to element buffer testxengineering
2023-06-29Make tests verbosexengineering
This helps to debug tests with t.Log() and t.Logf().
2023-06-29xmpp: Add indent level test for elementBufferxengineering
This tests if the indent level is correctly detected. This basic test can be extended to support invalid XML elements which should be refused to add to the element buffer.
2023-06-28xmpp: Implement basic elementBufferxengineering
This is needed to buffer XML elements of a stream until they are complete and can be given to an element handler.
2023-06-28Merge branch 'stream-pair'xengineering
This adds the source file xmpp/stream_pair.go with the central function runStreamPair(). This function is called once by a session and could call itself. That way an initial stream and nested streams are implemented and closed via return and defer.