coreconn.cpp 678 B

123456789101112131415161718192021222324252627282930
  1. #include "coreconn.h"
  2. #include "remote_connection.h"
  3. #include <util/datetime/base.h>
  4. #include <util/generic/yexception.h>
  5. #include <util/network/socket.h>
  6. #include <util/string/util.h>
  7. #include <util/system/thread.h>
  8. namespace NBus {
  9. TBusInstant Now() {
  10. return millisec();
  11. }
  12. EIpVersion MakeIpVersion(bool allowIpv4, bool allowIpv6) {
  13. if (allowIpv4) {
  14. if (allowIpv6) {
  15. return EIP_VERSION_ANY;
  16. } else {
  17. return EIP_VERSION_4;
  18. }
  19. } else if (allowIpv6) {
  20. return EIP_VERSION_6;
  21. }
  22. ythrow yexception() << "Neither of IPv4/IPv6 is allowed.";
  23. }
  24. }