mirror of
https://github.com/dlang/phobos.git
synced 2025-05-14 17:05:58 +03:00
Fix bug 1491
Add std.socket to the base unittest suite.
This commit is contained in:
parent
f3e1773c81
commit
ad29e17ff3
4 changed files with 11 additions and 4 deletions
|
@ -236,6 +236,7 @@ enum: int
|
||||||
MSG_OOB = 0x1,
|
MSG_OOB = 0x1,
|
||||||
MSG_PEEK = 0x2,
|
MSG_PEEK = 0x2,
|
||||||
MSG_DONTROUTE = 0x4,
|
MSG_DONTROUTE = 0x4,
|
||||||
|
MSG_NOSIGNAL = 0x4000,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -381,6 +381,7 @@ enum: int
|
||||||
MSG_OOB = 0x1,
|
MSG_OOB = 0x1,
|
||||||
MSG_PEEK = 0x2,
|
MSG_PEEK = 0x2,
|
||||||
MSG_DONTROUTE = 0x4,
|
MSG_DONTROUTE = 0x4,
|
||||||
|
MSG_NOSIGNAL = 0x0, /// not supported on win32, would be 0x4000 if it was
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -734,6 +734,7 @@ enum SocketFlags: int
|
||||||
OOB = MSG_OOB, /// out-of-band stream data
|
OOB = MSG_OOB, /// out-of-band stream data
|
||||||
PEEK = MSG_PEEK, /// peek at incoming data without removing it from the queue, only for receiving
|
PEEK = MSG_PEEK, /// peek at incoming data without removing it from the queue, only for receiving
|
||||||
DONTROUTE = MSG_DONTROUTE, /// data should not be subject to routing; this flag may be ignored. Only for sending
|
DONTROUTE = MSG_DONTROUTE, /// data should not be subject to routing; this flag may be ignored. Only for sending
|
||||||
|
NOSIGNAL = MSG_NOSIGNAL, /// don't send SIGPIPE signal on socket write error and instead return EPIPE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1270,6 +1271,7 @@ class Socket
|
||||||
//returns number of bytes actually sent, or -1 on error
|
//returns number of bytes actually sent, or -1 on error
|
||||||
int send(void[] buf, SocketFlags flags)
|
int send(void[] buf, SocketFlags flags)
|
||||||
{
|
{
|
||||||
|
flags |= SocketFlags.NOSIGNAL;
|
||||||
int sent = .send(sock, buf.ptr, buf.length, cast(int)flags);
|
int sent = .send(sock, buf.ptr, buf.length, cast(int)flags);
|
||||||
return sent;
|
return sent;
|
||||||
}
|
}
|
||||||
|
@ -1277,7 +1279,7 @@ class Socket
|
||||||
/// ditto
|
/// ditto
|
||||||
int send(void[] buf)
|
int send(void[] buf)
|
||||||
{
|
{
|
||||||
return send(buf, SocketFlags.NONE);
|
return send(buf, SocketFlags.NOSIGNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1285,6 +1287,7 @@ class Socket
|
||||||
*/
|
*/
|
||||||
int sendTo(void[] buf, SocketFlags flags, Address to)
|
int sendTo(void[] buf, SocketFlags flags, Address to)
|
||||||
{
|
{
|
||||||
|
flags |= SocketFlags.NOSIGNAL;
|
||||||
int sent = .sendto(sock, buf.ptr, buf.length, cast(int)flags, to.name(), to.nameLen());
|
int sent = .sendto(sock, buf.ptr, buf.length, cast(int)flags, to.name(), to.nameLen());
|
||||||
return sent;
|
return sent;
|
||||||
}
|
}
|
||||||
|
@ -1300,6 +1303,7 @@ class Socket
|
||||||
/// ditto
|
/// ditto
|
||||||
int sendTo(void[] buf, SocketFlags flags)
|
int sendTo(void[] buf, SocketFlags flags)
|
||||||
{
|
{
|
||||||
|
flags |= SocketFlags.NOSIGNAL;
|
||||||
int sent = .sendto(sock, buf.ptr, buf.length, cast(int)flags, null, 0);
|
int sent = .sendto(sock, buf.ptr, buf.length, cast(int)flags, null, 0);
|
||||||
return sent;
|
return sent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ import std.uni;
|
||||||
import std.file;
|
import std.file;
|
||||||
import std.signals;
|
import std.signals;
|
||||||
import std.cpuid;
|
import std.cpuid;
|
||||||
|
import std.socket;
|
||||||
|
|
||||||
int main(char[][] args)
|
int main(char[][] args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue