2
0
mirror of https://github.com/FluuxIO/go-xmpp synced 2024-11-11 07:11:03 +00:00
Commit Graph

17 Commits

Author SHA1 Message Date
Wichert Akkerman
a0e74051fd Use a channel based API for SendIQ
This makes sending IQ more idiomatic Go, but more importantly it solves
a problem with contexts that were not being cancelled correctly with
the previous API.

As a side-effect of this change `Route.route` must now be invoked in a
go-routine to prevent deadlocks. This also allows for stanzas to be processed
in parallel, which can result in a nice performance win.
2019-11-04 16:22:05 +01:00
Wichert Akkerman
83bc8581fd Cleanup the IQ result route API
Simplify the API in several ways:

- provide the context to the IQ result handler, making it possible to pass in
  extra context and handle timeouts within the handler.
- pass the stanza in as an IQ type, removing the need to always type-cast it
  in the handler
- remove Router.HandleIqResult and Router.HandleFuncIqResult. Since the router
  is private to Client nobody would ever use these, and they do not really make
  things simpler anyway.
2019-11-04 16:22:05 +01:00
Wichert Akkerman
6a25856e85 We need to lock isResultRoutes
The map is updated from multiple goroutines, so it needs to be locked.
2019-11-04 16:22:05 +01:00
Wichert Akkerman
8e1dac6ffa Add IQ result routes to the Router
These are used to quickly match IQ result stanzas and invoke a handler
for them. IQ result routes take precendence of normal routes.
2019-11-04 16:22:05 +01:00
Wichert Akkerman
7b1f83f6b7 Expose Route.AddMatcher
This fixes #102
2019-09-03 14:38:34 +02:00
Mickael Remond
428787d7ab
Refactor and move parsing and stanza to a separate package 2019-06-26 17:14:52 +02:00
Mickael Remond
83f96fbd41 Fix error code 2019-06-24 12:24:45 +02:00
Mickael Remond
1542110f1b If there is no match in router, properly send not-implemented reply for iq set & get 2019-06-24 12:24:45 +02:00
Mickael Remond
d6d371df4d Do not export Router.route as it is not supposed to be called directly 2019-06-24 12:24:45 +02:00
Mickael Remond
e9c704eff5
Fix router after #62 merge 2019-06-22 11:24:14 +02:00
Mickaël Rémond
145fce6b3f
Add StanzaType matcher / Clarify empty route behaviour (#65)
* Add route to match on stanza type

* Add test checking that an empty route "always" matches
2019-06-21 16:48:13 +02:00
Mickael Remond
af0ae525b8 An IQ can only have a single payload
"An IQ stanza of type "get" or "set" MUST contain exactly one
 child element, which specifies the semantics of the particular
 request."
2019-06-19 14:03:42 +02:00
Mickael Remond
4d015e5b29
With go modules, we should be able to remove import comments 2019-06-18 16:28:30 +02:00
Mickael Remond
28ae759144
Fix import path 2019-06-18 16:11:00 +02:00
Mickael Remond
c6f0d03f60 Add support for delegation namespace packet parsing
Refactor and clean up pubsub & pep files
2019-06-18 14:36:56 +02:00
Mickael Remond
9db33d5792 Introduce Sender interface to abstract client sending in router handlers 2019-06-18 14:36:56 +02:00
Mickael Remond
b05e68c844 Add router to make it easier to set up routing info
- Using the router, the dispatch is not done anymore by receiving from
  receive channel, but by registering callback functions in routers,
  with matchers.
- Make IQPayload a real interface to make it easier to match namespaces.
- The StreamManager Run command is now blocking, waiting for StreamManager
  to terminate.
2019-06-18 14:36:56 +02:00