Skip to content

Commit

Permalink
Remove redundant function nextPingExt() (#613)
Browse files Browse the repository at this point in the history
Functionally identical to the older, documented `getNextPingExt()`.

Fixes #610.

Signed-off-by: Paul Arthur <[email protected]>
  • Loading branch information
flowerysong authored Jun 9, 2024
1 parent aad6769 commit d28ae52
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2579,10 +2579,6 @@ void *preparePingExt(clusterMsgPingExt *ext, uint16_t type, uint32_t length) {
return &ext->ext[0];
}

clusterMsgPingExt *nextPingExt(clusterMsgPingExt *ext) {
return (clusterMsgPingExt *)((char *)ext + ntohl(ext->length));
}

/* 1. If a NULL hdr is provided, compute the extension size;
* 2. If a non-NULL hdr is provided, write the hostname ping
* extension at the start of the cursor. This function
Expand All @@ -2607,7 +2603,7 @@ uint32_t writePingExt(clusterMsg *hdr, int gossipcount) {
memcpy(ext->hostname, myself->hostname, sdslen(myself->hostname));

/* Move the write cursor */
cursor = nextPingExt(cursor);
cursor = getNextPingExt(cursor);
}

totlen += getHostnamePingExtSize();
Expand All @@ -2622,7 +2618,7 @@ uint32_t writePingExt(clusterMsg *hdr, int gossipcount) {
memcpy(ext->human_nodename, myself->human_nodename, sdslen(myself->human_nodename));

/* Move the write cursor */
cursor = nextPingExt(cursor);
cursor = getNextPingExt(cursor);
}

totlen += getHumanNodenamePingExtSize();
Expand All @@ -2644,7 +2640,7 @@ uint32_t writePingExt(clusterMsg *hdr, int gossipcount) {
ext->ttl = htonu64(ttl);

/* Move the write cursor */
cursor = nextPingExt(cursor);
cursor = getNextPingExt(cursor);
}
totlen += getForgottenNodeExtSize();
extensions++;
Expand All @@ -2658,7 +2654,7 @@ uint32_t writePingExt(clusterMsg *hdr, int gossipcount) {
memcpy(ext->shard_id, myself->shard_id, CLUSTER_NAMELEN);

/* Move the write cursor */
cursor = nextPingExt(cursor);
cursor = getNextPingExt(cursor);
}
totlen += getShardIdPingExtSize();
extensions++;
Expand Down

0 comments on commit d28ae52

Please sign in to comment.