1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-09 00:45:49 +02:00

Improve protocol handlers.

Make protocol handlers have one function per command. This allows the logic of finding the handler to be in ProtocolServer, isolates each command to a function, and removes the need to test the "not found" condition for each handler.
This commit is contained in:
David Steele
2021-03-16 13:09:34 -04:00
committed by GitHub
parent b1d945ebb7
commit 2016fac0d9
34 changed files with 866 additions and 611 deletions

View File

@ -178,8 +178,9 @@ testRun(void)
ioWriteOpen(write);
ProtocolServer *server = protocolServerNew(strNew("storage test server"), strNew("test"), read, write);
protocolServerHandlerAdd(server, storageRemoteProtocol);
protocolServerProcess(server, NULL);
static const ProtocolServerHandler commandHandler[] = {PROTOCOL_SERVER_HANDLER_STORAGE_REMOTE_LIST};
protocolServerProcess(server, NULL, commandHandler, PROTOCOL_SERVER_HANDLER_LIST_SIZE(commandHandler));
}
HARNESS_FORK_CHILD_END();