I don't know if this already exists in the library but it would be nice to expose the callback assignments for each us_socket_t object and be able to reassign them freely.
Something like this
struct us_socket_t *oldondata(struct us_socket_t *s, char *data, int length){
//some sockets still use the old on data if they haven't been reassigned
return s;
}
struct us_socket_t *newondata(struct us_socket_t *s, char *data, int length){
//now we're here for the previously joined socket
return s;
}
struct us_socket_t *onjoin(struct us_socket_t *s, char *data, int length){
if(somecondition){
s->on_data = newondata;
}
return s;
}
New sockets that join could have their on_data reassigned and the ones that do not get reassigned still use the oldondata from the initial context creation.
Would this be easy to change in the code or would it require much infrastructural changes?
I don't know if this already exists in the library but it would be nice to expose the callback assignments for each us_socket_t object and be able to reassign them freely. Something like this
New sockets that join could have their on_data reassigned and the ones that do not get reassigned still use the oldondata from the initial context creation.
Would this be easy to change in the code or would it require much infrastructural changes?