|
|
@@ -38,8 +38,11 @@ type PluginProtocolNetDialer func(network, addr string) (net.Conn, error)
|
|
|
// connection(s) and sends its log messages to loggerOutput.
|
|
|
// PluginProtocolDialer returns true if it attempts to create
|
|
|
// a connection, or false if it decides not to attempt a connection.
|
|
|
+// PluginProtocolDialer must add its connection to pendingConns
|
|
|
+// before the initial dial to allow for interruption.
|
|
|
type PluginProtocolDialer func(
|
|
|
loggerOutput io.Writer,
|
|
|
+ pendingConns *Conns,
|
|
|
netDialer PluginProtocolNetDialer,
|
|
|
addr string) (
|
|
|
bool, net.Conn, error)
|
|
|
@@ -54,13 +57,15 @@ func RegisterPluginProtocol(protcolDialer PluginProtocolDialer) {
|
|
|
// if set, to connect to addr over the plugin protocol.
|
|
|
func DialPluginProtocol(
|
|
|
loggerOutput io.Writer,
|
|
|
+ pendingConns *Conns,
|
|
|
netDialer PluginProtocolNetDialer,
|
|
|
addr string) (
|
|
|
bool, net.Conn, error) {
|
|
|
|
|
|
dialer := registeredPluginProtocolDialer.Load()
|
|
|
if dialer != nil {
|
|
|
- return dialer.(PluginProtocolDialer)(loggerOutput, netDialer, addr)
|
|
|
+ return dialer.(PluginProtocolDialer)(
|
|
|
+ loggerOutput, pendingConns, netDialer, addr)
|
|
|
}
|
|
|
return false, nil, nil
|
|
|
}
|