Changeset d163164 for launchers


Ignore:
Timestamp:
May 2, 2019 7:26:52 PM (11 months ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
214efb8
Parents:
315d772
Message:

Mac OSX Launcher: Misc updates related to router management.

Location:
launchers/macosx/I2PLauncher/routermgmt
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • launchers/macosx/I2PLauncher/routermgmt/DetectJava.swift

    r315d772 rd163164  
    5858      self.javaBinary = (self.javaHome+"/bin/java").replace(target: "\n", withString: "")
    5959      print("DetectJava.javaHome did change to "+self.javaHome)
    60       RouterManager.shared().eventManager.trigger(eventName: "java_found", information: self.javaHome)
     60      //RouterManager.shared().eventManager.trigger(eventName: "java_found", information: self.javaHome)
    6161    }
    6262  };
  • launchers/macosx/I2PLauncher/routermgmt/RouterManager.swift

    r315d772 rd163164  
    3131  private static func handleRouterException(information:Any?) {
    3232    Logger.MLog(level:1,"event! - handle router exception")
    33     Logger.MLog(level:1,information as! String)
     33    Logger.MLog(level:1,information as? String)
    3434  }
    3535  private static func handleRouterStart(information:Any?) {
     
    5050  }
    5151  private static func handleRouterPid(information:Any?) {
    52     Logger.MLog(level:1,"".appendingFormat("event! - handle router pid: ", information as! String!))
     52    Logger.MLog(level:1,"".appendingFormat("event! - handle router pid: ", information as! String))
    5353    if (information != nil) {
    5454      let intPid = Int(information as! String)
     55      print("Router pid is \(String(describing: intPid))..")
    5556    }
    5657  }
    5758  private static func handleRouterVersion(information:Any?) {
    5859    do {
    59       Logger.MLog(level:1, "".appendingFormat("event! - handle router version: ", information as! String!))
     60      Logger.MLog(level:1, "".appendingFormat("event! - handle router version: ", information as! String))
    6061      guard let currentVersion : String = information as? String else {
    6162        throw ErrorsInRouterMgmr.InvalidVersion
  • launchers/macosx/I2PLauncher/routermgmt/RouterProcessStatus.swift

    r315d772 rd163164  
    5757}
    5858
    59 
    60 
    61 
    62 extension RouterProcessStatus {
    63   static func checkTcpPortForListen(port: in_port_t) -> (Bool, descr: String){
    64    
    65     let socketFileDescriptor = socket(AF_INET, SOCK_STREAM, 0)
    66     if socketFileDescriptor == -1 {
    67       return (false, "SocketCreationFailed, \(descriptionOfLastError())")
    68     }
    69    
    70     var addr = sockaddr_in()
    71     let sizeOfSockkAddr = MemoryLayout<sockaddr_in>.size
    72     addr.sin_len = __uint8_t(sizeOfSockkAddr)
    73     addr.sin_family = sa_family_t(AF_INET)
    74     addr.sin_port = Int(OSHostByteOrder()) == OSLittleEndian ? _OSSwapInt16(port) : port
    75     addr.sin_addr = in_addr(s_addr: inet_addr("0.0.0.0"))
    76     addr.sin_zero = (0, 0, 0, 0, 0, 0, 0, 0)
    77     var bind_addr = sockaddr()
    78     memcpy(&bind_addr, &addr, Int(sizeOfSockkAddr))
    79    
    80     if Darwin.bind(socketFileDescriptor, &bind_addr, socklen_t(sizeOfSockkAddr)) == -1 {
    81       let details = descriptionOfLastError()
    82       release(socket: socketFileDescriptor)
    83       return (false, "\(port), BindFailed, \(details)")
    84     }
    85     if listen(socketFileDescriptor, SOMAXCONN ) == -1 {
    86       let details = descriptionOfLastError()
    87       release(socket: socketFileDescriptor)
    88       return (false, "\(port), ListenFailed, \(details)")
    89     }
    90     release(socket: socketFileDescriptor)
    91     return (true, "\(port) is free for use")
    92   }
    93  
    94   static func release(socket: Int32) {
    95     Darwin.shutdown(socket, SHUT_RDWR)
    96     close(socket)
    97   }
    98   static func descriptionOfLastError() -> String {
    99     return String(cString: UnsafePointer(strerror(errno)))
    100   }
    101 }
    102 
  • launchers/macosx/I2PLauncher/routermgmt/RouterRunner.swift

    r315d772 rd163164  
    2525  let plistName = String(NSString(format: "%@.I2PRouter.plist", APPDOMAIN))
    2626 
    27   //let appSupportPath = FileManager.default.urls(for: FileManager.SearchPathDirectory.applicationSupportDirectory, in: FileManager.SearchPathDomainMask.userDomainMask)
     27  let appSupportPath = FileManager.default.urls(for: FileManager.SearchPathDirectory.applicationSupportDirectory, in: FileManager.SearchPathDomainMask.userDomainMask)
    2828 
    2929  override init() {
     
    7373    var classpath:String = "."
    7474    for jar in jars {
    75       classpath += ":"+basePath+"/lib/"+jar
     75      if (jar.hasSuffix(".jar")) {
     76        classpath += ":"+basePath+"/lib/"+jar
     77      }
    7678    }
    7779   
Note: See TracChangeset for help on using the changeset viewer.