Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ bionic::socktype bionic::from_host_socktype(int socktype) {
case SOCK_STREAM: return socktype::STREAM;
case SOCK_DGRAM: return socktype::DGRAM;
case SOCK_RAW: return socktype::RAW;
default: throw std::runtime_error("Unknown socktype");
case 0: return socktype::ANY;
default:
printf("WARNING: Unknown socktype\n");
return socktype::ANY;
}
}

Expand All @@ -68,7 +71,10 @@ int bionic::to_host_socktype(bionic::socktype socktype) {
case socktype::STREAM: return SOCK_STREAM;
case socktype::DGRAM: return SOCK_DGRAM;
case socktype::RAW: return SOCK_RAW;
default: throw std::runtime_error("Unknown socktype");
case socktype::ANY: return 0;
default:
printf("WARNING: Unknown socktype\n");
return 0;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace shim {
};

enum class socktype : int {
ANY = 0,
STREAM = 1,
DGRAM = 2,
RAW = 3
Expand Down