{"action":"created","issue":{"url":"https://api.github.com/repos/nyholku/purejavacomm/issues/106","repository_url":"https://api.github.com/repos/nyholku/purejavacomm","labels_url":"https://api.github.com/repos/nyholku/purejavacomm/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/nyholku/purejavacomm/issues/106/comments","events_url":"https://api.github.com/repos/nyholku/purejavacomm/issues/106/events","html_url":"https://github.com/nyholku/purejavacomm/issues/106","id":306614032,"number":106,"title":"Non-responsive bluetooth serial port hangs application ","user":{"login":"GlennED","id":26574816,"avatar_url":"https://avatars1.githubusercontent.com/u/26574816?v=4","gravatar_id":"","url":"https://api.github.com/users/GlennED","html_url":"https://github.com/GlennED","followers_url":"https://api.github.com/users/GlennED/followers","following_url":"https://api.github.com/users/GlennED/following{/other_user}","gists_url":"https://api.github.com/users/GlennED/gists{/gist_id}","starred_url":"https://api.github.com/users/GlennED/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GlennED/subscriptions","organizations_url":"https://api.github.com/users/GlennED/orgs","repos_url":"https://api.github.com/users/GlennED/repos","events_url":"https://api.github.com/users/GlennED/events{/privacy}","received_events_url":"https://api.github.com/users/GlennED/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-03-19T20:04:51Z","updated_at":"2018-03-20T14:03:55Z","closed_at":null,"author_association":"NONE","body":"The following is a code snippet from the CommPortIdentifier class method open:\r\n\r\nif (info != null)\r\n\tport = info.m_Driver.getCommPort(m_PortName, info.m_PortType);\r\nelse\r\n\tport = new PureJavaSerialPort(m_PortName, timeout); // FIXME timeout here is not used\r\n\r\nThe following code snippet from the PureJavaSerialPort class:\r\n\r\n        PureJavaSerialPort(String name, int timeout) throws PortInUseException {\r\n\t\tsuper();\r\n\r\n\t\tboolean usepoll = false;\r\n\t\tif (JTermios.canPoll()) {\r\n\t\t\tString key1 = \"purejavacomm.use_poll\";\r\n\t\t\tString key2 = \"purejavacomm.usepoll\";\r\n\t\t\tif (System.getProperty(key1) != null) {\r\n\t\t\t\tusepoll = Boolean.getBoolean(key1);\r\n\t\t\t\tlog = log && log(1, \"use of '%s' is deprecated, use '%s' instead\\n\", key1, key2);\r\n\t\t\t} else if (System.getProperty(key2) != null)\r\n\t\t\t\tusepoll = Boolean.getBoolean(key2);\r\n\t\t\telse\r\n\t\t\t\tusepoll = true;\r\n\t\t}\r\n\t\tUSE_POLL = usepoll;\r\n\r\n\t\tRAW_READ_MODE = Boolean.getBoolean(\"purejavacomm.rawreadmode\");\r\n\r\n\t\tthis.name = name;\r\n\r\n\t\tint tries = (timeout + 5) / 10;\r\n\t\twhile ((m_FD = open(name, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) {\r\n\t\t\tint errno = errno();\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(10);\r\n\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t\tThread.currentThread().interrupt();\r\n\t\t\t}\r\n\t\t\tif (tries-- < 0)\r\n\t\t\t\tthrow new PortInUseException(\"Unknown Application\", errno);\r\n\t\t}\r\n\r\nIt appears that the \"timeout\" value is 3000 and this results in the \"tries\" to be 300. Since a bluetooth port does not respond when the bluetooth device is off it takes an extremely long time to return from the \"open\" method. The comment \"FIXME timeout here is not used\" suggests that the \"tries\" value can be passed as an argument instead of the \"timeout\" parameter.\r\n\r\nI will try this myself but if you know any reason why this is not a good idea please let me know. Thanks.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nyholku/purejavacomm/issues/comments/374609268","html_url":"https://github.com/nyholku/purejavacomm/issues/106#issuecomment-374609268","issue_url":"https://api.github.com/repos/nyholku/purejavacomm/issues/106","id":374609268,"user":{"login":"nyholku","id":720813,"avatar_url":"https://avatars2.githubusercontent.com/u/720813?v=4","gravatar_id":"","url":"https://api.github.com/users/nyholku","html_url":"https://github.com/nyholku","followers_url":"https://api.github.com/users/nyholku/followers","following_url":"https://api.github.com/users/nyholku/following{/other_user}","gists_url":"https://api.github.com/users/nyholku/gists{/gist_id}","starred_url":"https://api.github.com/users/nyholku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyholku/subscriptions","organizations_url":"https://api.github.com/users/nyholku/orgs","repos_url":"https://api.github.com/users/nyholku/repos","events_url":"https://api.github.com/users/nyholku/events{/privacy}","received_events_url":"https://api.github.com/users/nyholku/received_events","type":"User","site_admin":false},"created_at":"2018-03-20T14:03:55Z","updated_at":"2018-03-20T14:03:55Z","author_association":"OWNER","body":"More precisely I'm concerned about the possibilities things I cannot see! \r\n\r\nThis approach looks \"  long after = System.currentTimeMillis(); if (after - before > timeout)\" looks perfectly reasonable and difficult to see how that could fail.\r\n\r\nHowever, when I wrote that code I had a reason to code it the way it was coded and I'm slightly concerned if the 'new' way is 100% compatible with old way.\r\n\r\nBut it is difficult to say how the 'new' way could cause problems for old users."}}
{"actor":{"display_login":"nyholku"}}