tcp2.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <util/datetime/base.h>
  3. #include <util/system/defaults.h>
  4. namespace NNeh {
  5. //global options
  6. struct TTcp2Options {
  7. //connect timeout
  8. static TDuration ConnectTimeout;
  9. //input buffer size
  10. static size_t InputBufferSize;
  11. //asio client threads
  12. static size_t AsioClientThreads;
  13. //asio server threads, - if == 0, use acceptor thread for read/parse incoming requests
  14. //esle use one thread for accepting + AsioServerThreads for process established tcp connections
  15. static size_t AsioServerThreads;
  16. //listen socket queue limit
  17. static int Backlog;
  18. //try call non block write to socket from client thread (for decrease latency)
  19. static bool ClientUseDirectWrite;
  20. //try call non block write to socket from client thread (for decrease latency)
  21. static bool ServerUseDirectWrite;
  22. //expecting receiving request data right after connect or inside receiving request data
  23. static TDuration ServerInputDeadline;
  24. //timelimit for sending response data
  25. static TDuration ServerOutputDeadline;
  26. //set option, - return false, if option name not recognized
  27. static bool Set(TStringBuf name, TStringBuf value);
  28. };
  29. class IProtocol;
  30. IProtocol* Tcp2Protocol();
  31. }