Remove unused setter for Port::socket_factory()

Also take the opportunity to declare factory_ const.
(Bug reference is where I noticed the possibility; it is unlikely
to fix the bug.)

Bug: chromium:1205343
Change-Id: I6078f170cf68d94314ee184bdfd2dc6f4ffc1e71
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217385
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33918}
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index 79b83b7..d24d40f 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -137,6 +137,7 @@
       tiebreaker_(0),
       shared_socket_(true),
       weak_factory_(this) {
+  RTC_DCHECK(factory_ != NULL);
   Construct();
 }
 
diff --git a/p2p/base/port.h b/p2p/base/port.h
index 66da9b8..7759ade 100644
--- a/p2p/base/port.h
+++ b/p2p/base/port.h
@@ -218,9 +218,6 @@
 
   // The factory used to create the sockets of this port.
   rtc::PacketSocketFactory* socket_factory() const { return factory_; }
-  void set_socket_factory(rtc::PacketSocketFactory* factory) {
-    factory_ = factory;
-  }
 
   // For debugging purposes.
   const std::string& content_name() const { return content_name_; }
@@ -445,7 +442,7 @@
   void OnNetworkTypeChanged(const rtc::Network* network);
 
   rtc::Thread* const thread_;
-  rtc::PacketSocketFactory* factory_;
+  rtc::PacketSocketFactory* const factory_;
   std::string type_;
   bool send_retransmit_count_attribute_;
   rtc::Network* network_;