View Issue Details

IDProjectCategoryView StatusLast Update
0003108GNUnetutil librarypublic2018-06-06 22:25
Reportertg Assigned Totg Due Date
PrioritynormalSeveritytweakReproducibilityN/A
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.11.0pre66Fixed in Version0.11.0pre66 
Summary0003108: Separate message handler functions for the client library
DescriptionCurrently the server and client library are inconsistent in the way they implement message handler callbacks.

The server lib takes a handlers array with a separate callback function for each message type:

void
GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server,
                            const struct GNUNET_SERVER_MessageHandler
                            *handlers);

And a function to resume receiving:

void
GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client,
                int success);

While the client lib has a single receive function that takes a message handler callback that receives all messages:

void
GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client,
                       GNUNET_CLIENT_MessageHandler handler, void *handler_cls,
                       struct GNUNET_TIME_Relative timeout);

The server API is cleaner, changing the client API like that would make the client code a bit cleaner.

This would take more time to fix as it affects every service. Perhaps it is more feasible to implement the new API and remove the old one after every service switched to it, this would allow new services already use separate message handlers. (Or alternatively a temp solution is to implement a function that can be passed in as a callback to GNUNET_CLIENT_receive() and takes a MessageHandlers array as argument)
TagsNo tags attached.

Activities

Christian Grothoff

2013-11-13 20:56

manager   ~0007628

Yes, this was already discussed between me and (IIRC) Florian Dold. I'm not against making the client API resemble the server API more in principle, but this is a somewhat invasive change and the existing code does work, so it hasn't been a priority for me. But in principle changes in this direction that do not break stuff are fine.

tg

2014-06-02 16:01

reporter   ~0008378

I have implemented this in the client manager API. This way the old API did not change, and new services can use the higher level API if desired.

Issue History

Date ModifiedUsernameFieldChange
2013-11-11 20:20tgNew Issue
2013-11-13 20:56Christian GrothoffNote Added: 0007628
2013-11-13 20:56Christian GrothoffStatusnew => confirmed
2014-06-02 16:01tgAssigned To => tg
2014-06-02 16:01tgStatusconfirmed => assigned
2014-06-02 16:01tgNote Added: 0008378
2014-06-02 16:01tgStatusassigned => resolved
2014-06-02 16:01tgFixed in Version => Git master
2014-06-02 16:01tgResolutionopen => fixed
2014-06-08 13:16Christian GrothoffFixed in VersionGit master => 0.11.0pre66
2014-06-08 13:16Christian GrothoffTarget Version => 0.11.0pre66
2018-06-06 22:25Christian GrothoffStatusresolved => closed