зеркало из https://github.com/mozilla/pluotsorbet.git
Merge pull request #364 from mykmelez/read-on-closed-socket
return -1 early when Protocol.read0 called on closed socket
This commit is contained in:
Коммит
b9b1520e88
|
@ -77,6 +77,11 @@ Native["com/sun/midp/io/j2me/socket/Protocol.available0.()I"] = function(ctx, st
|
|||
Native["com/sun/midp/io/j2me/socket/Protocol.read0.([BII)I"] = function(ctx, stack) {
|
||||
var length = stack.pop(), offset = stack.pop(), data = stack.pop(), _this = stack.pop();
|
||||
|
||||
if (_this.socket.readyState == "closed") {
|
||||
stack.push(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
function copyData() {
|
||||
var toRead = (length < _this.data.byteLength) ? length : _this.data.byteLength;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче