mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
try more when writev return EINTR
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
#include "mread.h"
|
#include "mread.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
#include "map.h"
|
|
||||||
|
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "skynet.h"
|
#include "skynet.h"
|
||||||
|
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@@ -20,7 +21,17 @@ _cb(struct skynet_context * context, void * ud, int session, const char * addr,
|
|||||||
buffer[1].iov_base = (void *)msg;
|
buffer[1].iov_base = (void *)msg;
|
||||||
buffer[1].iov_len = sz;
|
buffer[1].iov_len = sz;
|
||||||
|
|
||||||
writev(fd, buffer, 2);
|
for (;;) {
|
||||||
|
int err = writev(fd, buffer, 2);
|
||||||
|
if (err < 0) {
|
||||||
|
switch (errno) {
|
||||||
|
case EAGAIN:
|
||||||
|
case EINTR:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Reference in New Issue
Block a user