[haiku-gsoc] Re: Queries regarding the current code for tcp

  • From: Ayush Agrawal <echo.27.04.96@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Mon, 5 Jun 2017 00:08:17 +0530

Sorry I didn't complete the mail..

*Q3. *tcp.cpp, checking the argument "level" in two different ways:
                  line 525 @ tcp_control: (level & LEVEL_MASK) ==
IPPROTO_TCP
                  line 541 @ tcp_getsockopt: (level == IPPROTO_TCP)
Why the difference?

*Q4. *tcp.cpp, line 291 @ get_endpoint_manager. First it makes a call to
*endpoint_manager_for*. If that returns NULL, it makes a call to
*endpoint_manager_for_locked*. Why does it do that when
*endpoint_manager_for* itself internally calls *endpoint_manager_for_locked*?


The only difference I could spot out was that when *get_endpoint_manger*
itself calls *endpoint_manager_for_locked* it beforehand acquires a
WriteLocker on sEndpointManagersLock while *endpoint_manager_for *beforehand
acquires a ReadLocker.

Other related posts: