#include "afb-common.h"
#include "afb-msg-json.h"
#include "afb-session.h"
+#include "afb-cred.h"
#include "afb-apis.h"
#include "afb-xreq.h"
#include "afb-context.h"
struct afb_session *session;
struct afb_evt_listener *listener;
struct afb_wsj1 *wsj1;
+ struct afb_cred *cred;
int new_session;
};
if (result->listener == NULL)
goto error4;
+ result->cred = afb_cred_create_for_socket(fd);
return result;
error4:
if (ws->cleanup != NULL)
ws->cleanup(ws->cleanup_closure);
afb_session_unref(ws->session);
+ afb_cred_unref(ws->cred);
free(ws);
}
}
static void wsreq_reply(struct afb_wsreq *wsreq, int iserror, json_object *obj)
{
int rc;
+
rc = (iserror ? afb_wsj1_reply_error_j : afb_wsj1_reply_ok_j)(
wsreq->msgj1, obj, afb_context_sent_token(&wsreq->xreq.context));
if (rc)
- ERROR("Can't send reply: %m (was %s)", json_object_get_string(obj));
+ ERROR("Can't send reply: %m");
}