ImmutableCommunicationTimeouts.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Dispatcher
  5. {
  6. using System;
  7. class ImmutableCommunicationTimeouts : IDefaultCommunicationTimeouts
  8. {
  9. TimeSpan close;
  10. TimeSpan open;
  11. TimeSpan receive;
  12. TimeSpan send;
  13. internal ImmutableCommunicationTimeouts()
  14. : this(null)
  15. {
  16. }
  17. internal ImmutableCommunicationTimeouts(IDefaultCommunicationTimeouts timeouts)
  18. {
  19. if (timeouts == null)
  20. {
  21. this.close = ServiceDefaults.CloseTimeout;
  22. this.open = ServiceDefaults.OpenTimeout;
  23. this.receive = ServiceDefaults.ReceiveTimeout;
  24. this.send = ServiceDefaults.SendTimeout;
  25. }
  26. else
  27. {
  28. this.close = timeouts.CloseTimeout;
  29. this.open = timeouts.OpenTimeout;
  30. this.receive = timeouts.ReceiveTimeout;
  31. this.send = timeouts.SendTimeout;
  32. }
  33. }
  34. TimeSpan IDefaultCommunicationTimeouts.CloseTimeout
  35. {
  36. get { return this.close; }
  37. }
  38. TimeSpan IDefaultCommunicationTimeouts.OpenTimeout
  39. {
  40. get { return this.open; }
  41. }
  42. TimeSpan IDefaultCommunicationTimeouts.ReceiveTimeout
  43. {
  44. get { return this.receive; }
  45. }
  46. TimeSpan IDefaultCommunicationTimeouts.SendTimeout
  47. {
  48. get { return this.send; }
  49. }
  50. }
  51. }