Skip to content

Commit

Permalink
Fix build fail when enabling distribution debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lrascao committed Oct 5, 2015
1 parent 1523be4 commit 4759886
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions erts/emulator/beam/dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include "erl_thr_progress.h"
#include "dtrace-wrapper.h"

#define DIST_CTL_DEFAULT_SIZE 64

/* Turn this on to get printouts of all distribution messages
* which go on the line
*/
Expand All @@ -66,20 +68,23 @@ static void bw(byte *buf, ErlDrvSizeT sz)
static void
dist_msg_dbg(ErtsDistExternal *edep, char *what, byte *buf, int sz)
{
ErtsHeapFactory factory;
DeclareTmpHeapNoproc(ctl_default,DIST_CTL_DEFAULT_SIZE);
Eterm* ctl = ctl_default;
byte *extp = edep->extp;
Eterm msg;
Sint size = erts_decode_dist_ext_size(edep);
Sint ctl_len;
Sint size = ctl_len = erts_decode_dist_ext_size(edep);
if (size < 0) {
erts_fprintf(stderr,
"DIST MSG DEBUG: erts_decode_dist_ext_size(%s) failed:\n",
what);
bw(buf, sz);
}
else {
Eterm *hp;
ErlHeapFragment *mbuf = new_message_buffer(size);
hp = mbuf->mem;
msg = erts_decode_dist_ext(&hp, &mbuf->off_heap, edep);
erts_factory_static_init(&factory, ctl, ctl_len, &mbuf->off_heap);
msg = erts_decode_dist_ext(&factory, edep);
if (is_value(msg))
erts_fprintf(stderr, " %s: %T\n", what, msg);
else {
Expand Down Expand Up @@ -1136,7 +1141,6 @@ int erts_net_message(Port *prt,
byte *buf,
ErlDrvSizeT len)
{
#define DIST_CTL_DEFAULT_SIZE 64
ErtsDistExternal ede;
byte *t;
Sint ctl_len;
Expand Down Expand Up @@ -1790,8 +1794,8 @@ erts_dsig_send(ErtsDSigData *dsdp, struct erts_dsig_send_context* ctx)

#ifdef ERTS_DIST_MSG_DBG
erts_fprintf(stderr, ">>%s CTL: %T\n", ctx->pass_through_size ? "P" : " ", ctx->ctl);
if (is_value(msg))
erts_fprintf(stderr, " MSG: %T\n", msg);
if (is_value(ctx->msg))
erts_fprintf(stderr, " MSG: %T\n", ctx->msg);
#endif

ctx->data_size = ctx->pass_through_size;
Expand Down

0 comments on commit 4759886

Please sign in to comment.