| 2948 | } |
| 2949 | |
| 2950 | sds getAllClientsInfoString(int type) { |
| 2951 | listNode *ln; |
| 2952 | listIter li; |
| 2953 | client *client; |
| 2954 | sds o = sdsnewlen(SDS_NOINIT,200*listLength(g_pserver->clients)); |
| 2955 | sdsclear(o); |
| 2956 | listRewind(g_pserver->clients,&li); |
| 2957 | while ((ln = listNext(&li)) != NULL) { |
| 2958 | client = reinterpret_cast<struct client*>(listNodeValue(ln)); |
| 2959 | std::unique_lock<decltype(client->lock)> lock(client->lock); |
| 2960 | if (client->flags & CLIENT_CLOSE_ASAP) continue; |
| 2961 | if (type != -1 && getClientType(client) != type) continue; |
| 2962 | o = catClientInfoString(o,client); |
| 2963 | o = sdscatlen(o,"\n",1); |
| 2964 | } |
| 2965 | return o; |
| 2966 | } |
| 2967 | |
| 2968 | /* This function implements CLIENT SETNAME, including replying to the |
| 2969 | * user with an error if the charset is wrong (in that case C_ERR is |
no test coverage detected