diff options
author | Sverker Eriksson <[email protected]> | 2019-04-09 16:32:06 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-04-09 17:04:38 +0200 |
commit | ef44ba53defa0002ca6b12a786bd2d3555b0bb7b (patch) | |
tree | 85b848dce49edd113194fb592ebbed5068d86598 /lib/erl_interface/src/encode/encode_port.c | |
parent | d293c3ff700c1a0992a32dc3da9ae18964893c23 (diff) | |
download | otp-ef44ba53defa0002ca6b12a786bd2d3555b0bb7b.tar.gz otp-ef44ba53defa0002ca6b12a786bd2d3555b0bb7b.tar.bz2 otp-ef44ba53defa0002ca6b12a786bd2d3555b0bb7b.zip |
Revert "erl_interface: Remove old encoding of pid,port,refs"
This reverts commit 78ea501bcc84bd8bd49da97e514c1c3b20682d86.
Diffstat (limited to 'lib/erl_interface/src/encode/encode_port.c')
-rw-r--r-- | lib/erl_interface/src/encode/encode_port.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/erl_interface/src/encode/encode_port.c b/lib/erl_interface/src/encode/encode_port.c index 0fb4018db1..eb464380c0 100644 --- a/lib/erl_interface/src/encode/encode_port.c +++ b/lib/erl_interface/src/encode/encode_port.c @@ -25,6 +25,7 @@ int ei_encode_port(char *buf, int *index, const erlang_port *p) { char *s = buf + *index; + const char tag = p->creation > 3 ? ERL_NEW_PORT_EXT : ERL_PORT_EXT; ++(*index); /* skip ERL_PORT_EXT */ if (ei_encode_atom_len_as(buf, index, p->node, strlen(p->node), ERLANG_UTF8, @@ -32,15 +33,19 @@ int ei_encode_port(char *buf, int *index, const erlang_port *p) return -1; } if (buf) { - put8(s, ERL_NEW_PORT_EXT); + put8(s, tag); s = buf + *index; /* now the integers */ put32be(s,p->id & 0x0fffffff /* 28 bits */); - put32be(s, p->creation); + if (tag == ERL_PORT_EXT) { + put8(s,(p->creation & 0x03)); + } else { + put32be(s, p->creation); + } } - *index += 4 + 4; + *index += 4 + (tag == ERL_PORT_EXT ? 1 : 4); return 0; } |