touched up Socket.moo

This commit is contained in:
hyunghwan.chung 2018-01-28 15:47:56 +00:00
parent 7f7f9e2977
commit cf8daaa8a3

View File

@ -336,7 +336,7 @@ extend Socket
]
}
method writeBytes: bytes
method writeBytes: bytes offset: offset length: length
{
| old_output_action |
@ -348,7 +348,7 @@ extend Socket
old_output_action := self.outputAction.
self.outputAction := [ :sck :state |
if ((self _writeBytes: bytes) <= -1)
if ((self _writeBytes: bytes offset: offset length: length) <= -1)
{
## EAGAIN
self.outputReady := false.
@ -367,6 +367,11 @@ extend Socket
self watchOutput.
}
method writeBytes: bytes
{
^self writeBytes: bytes offset: 0 length: (bytes size)
}
## TODO: how to specify a timeout for an action? using another semaphore??
method watchInput
@ -508,10 +513,11 @@ error -> exception
{
(n asString & ' bytes read') dump.
data dump.
}.
##sck writeBytes: #[ $h, $e, $l, $l, $o, $., $., $., C'\n' ].
sck writeBytes: data.
sck writeBytes: data offset: 0 length: n.
}.
}
while (true).
].