mirror of
https://github.com/wassname/ray.git
synced 2026-08-15 12:45:23 +08:00
Allow reading/writing generic message types, not just tasks. (#24)
* Allow reading/writing generic message types, not just tasks. * Allow messages of length 0 to be read/written, and handle closed sockets. * Address comments. * Simplify accept_client. * Allow ports to be reused in bind_ipc_sock.
This commit is contained in:
committed by
Philipp Moritz
parent
631de92170
commit
084220b0e7
@@ -148,19 +148,6 @@ void free_task_spec(task_spec *spec) {
|
||||
free(spec);
|
||||
}
|
||||
|
||||
void write_task(int fd, task_spec *spec) {
|
||||
write_bytes(fd, (uint8_t *) spec, task_size(spec));
|
||||
}
|
||||
|
||||
task_spec *read_task(int fd) {
|
||||
uint8_t *bytes;
|
||||
int64_t length;
|
||||
read_bytes(fd, &bytes, &length);
|
||||
task_spec *spec = (task_spec *) bytes;
|
||||
CHECK(task_size(spec) == length);
|
||||
return spec;
|
||||
}
|
||||
|
||||
void print_task(task_spec *spec, UT_string *output) {
|
||||
/* For converting an id to hex, which has double the number
|
||||
* of bytes compared to the id (+ 1 byte for '\0'). */
|
||||
|
||||
Reference in New Issue
Block a user