MCPcopy Create free account
hub / github.com/apache/mesos / on_accept

Function on_accept

3rdparty/libprocess/src/process.cpp:901–937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899namespace internal {
900
901void on_accept(const Future<Socket>& socket)
902{
903 // We stop the accept loop when libprocess is finalizing.
904 // Either we'll see a discarded socket here, or we'll see
905 // the server socket set to null below.
906 bool stopped = false;
907
908 if (socket.isDiscarded()) {
909 stopped = true;
910 } else if (socket.isFailed()) {
911 LOG(WARNING) << "Failed to accept socket: " << socket.failure();
912 } else {
913 CHECK_READY(socket);
914
915 // Inform the socket manager for proper bookkeeping.
916 socket_manager->accepted(socket.get());
917
918 // Start the receive loop for the socket.
919 receive(socket.get());
920 }
921
922 // NOTE: `__s__` may be cleaned up during `process::finalize`.
923 if (!stopped) {
924 synchronized (socket_mutex) {
925 if (__s__ != nullptr) {
926 future_accept = __s__->accept()
927 .onAny(lambda::bind(&on_accept, lambda::_1));
928 } else {
929 stopped = true;
930 }
931 }
932 }
933
934 if (stopped) {
935 LOG(INFO) << "Stopped the socket accept loop";
936 }
937}
938
939} // namespace internal {
940

Callers

nothing calls this directly

Calls 6

isDiscardedMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
acceptedMethod · 0.80
receiveFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected