squito commented on a change in pull request #24834: [SPARK-27992][PYTHON] 
Synchronize with Python connection thread to propagate errors
URL: https://github.com/apache/spark/pull/24834#discussion_r296801113
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/security/SocketAuthServer.scala
 ##########
 @@ -66,42 +87,45 @@ private[spark] abstract class SocketAuthServer[T](
 
 }
 
+/**
+ * Create a socket server class and run user function on the socket in a 
background thread.
+ * This is the same as calling SocketAuthServer.setupOneConnectionServer 
except it creates
+ * a server object that can then be synced from Python.
+ */
+private[spark] class SocketFuncServer(
+    authHelper: SocketAuthHelper,
+    threadName: String,
+    func: Socket => Unit) extends SocketAuthServer[Unit](authHelper, 
threadName) {
+
+  override def handleConnection(sock: Socket): Unit = {
+    func(sock)
+  }
+}
+
 private[spark] object SocketAuthServer {
 
   /**
-   * Create a socket server and run user function on the socket in a 
background thread.
-   *
-   * The socket server can only accept one connection, or close if no 
connection
-   * in 15 seconds.
 
 Review comment:
   please save this comment -- I guess move it to the class `SocketAuthServer`. 
 In particular ,its helpful to note that this only accepts one connection, its 
not a long-lived thing which is reused.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to