| 1915 | * REDISMODULE_OK and the structure pointed by 'ci' gets populated. */ |
| 1916 | |
| 1917 | int modulePopulateClientInfoStructure(void *ci, client *client, int structver) { |
| 1918 | if (structver != 1) return REDISMODULE_ERR; |
| 1919 | |
| 1920 | RedisModuleClientInfoV1 *ci1 = ci; |
| 1921 | memset(ci1,0,sizeof(*ci1)); |
| 1922 | ci1->version = structver; |
| 1923 | if (client->flags & CLIENT_MULTI) |
| 1924 | ci1->flags |= REDISMODULE_CLIENTINFO_FLAG_MULTI; |
| 1925 | if (client->flags & CLIENT_PUBSUB) |
| 1926 | ci1->flags |= REDISMODULE_CLIENTINFO_FLAG_PUBSUB; |
| 1927 | if (client->flags & CLIENT_UNIX_SOCKET) |
| 1928 | ci1->flags |= REDISMODULE_CLIENTINFO_FLAG_UNIXSOCKET; |
| 1929 | if (client->flags & CLIENT_TRACKING) |
| 1930 | ci1->flags |= REDISMODULE_CLIENTINFO_FLAG_TRACKING; |
| 1931 | if (client->flags & CLIENT_BLOCKED) |
| 1932 | ci1->flags |= REDISMODULE_CLIENTINFO_FLAG_BLOCKED; |
| 1933 | if (connGetType(client->conn) == CONN_TYPE_TLS) |
| 1934 | ci1->flags |= REDISMODULE_CLIENTINFO_FLAG_SSL; |
| 1935 | |
| 1936 | int port; |
| 1937 | connPeerToString(client->conn,ci1->addr,sizeof(ci1->addr),&port); |
| 1938 | ci1->port = port; |
| 1939 | ci1->db = client->db->id; |
| 1940 | ci1->id = client->id; |
| 1941 | return REDISMODULE_OK; |
| 1942 | } |
| 1943 | |
| 1944 | /* This is an helper for moduleFireServerEvent() and other functions: |
| 1945 | * It populates the replication info structure with the appropriate |
no test coverage detected