On entering or leaving a port, harbor, or river, the master of a vessel, the navigation of which is not in charge of a pilot, licensed for that port, harbor, or river, shall take a pilot if one offers himself. While the pilot is on board the navigation of the vessel devolves on him.